Cannot import foma to Python
jzr-supove opened this issue · comments
Jasur Yusupov commented
Installed foma:
sudo apt-get install foma
Downloaded foma.py
as a module into my Python virtual environment:
Tried to import foma
and got an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/username/dir/venv/lib/python3.8/site-packages/foma/__init__.py", line 107, in <module>
foma_add_defined_function = foma.add_defined_function
File "/usr/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/x86_64-linux-gnu/libfoma.so.0: undefined symbol: add_defined_function
Python documentation is unclear!
Jasur Yusupov commented
Seems like the issue was in libfoma0 version (1:0.9.18)
$ sudo apt list -a libfoma0
Listing... Done
libfoma0/focal,now 1:0.9.18+r243-6 amd64 [installed,automatic]
libfoma0/unknown 0.10.0+s305-3~focal1 amd64
Installing version 0.10.0 solved the problem:
sudo apt-get install libfoma0=0.10.0+s305-3~focal1