Python import error when atomspace module is not loaded before a module with custom Atom types
robert-haas opened this issue · 2 comments
Error description
Trying to import the cheminformatics module in Python 3.8
from opencog import cheminformatics
results in following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 from opencog import cheminformatics
ImportError: /usr/local/lib/opencog/libatom_types.so: undefined symbol: _ZN7opencog11ClassServer16update_factoriesEv
Temporary workaround suggested by Linas in Discord:
Import the atomspace module first, e.g. with from opencog import atomspace
.
Edit: In my case this did not help initially. After a reinstallation the error reappared but now the workaround actually resolves it.
System info
OS: Ubuntu 20.04.4 LTS
Installation: I cloned, compiled and installed the cogutil
, atomspace
and cheminformatics
repositories. I'm also using miniconda as package manager for Python, which has its own directory structure independent from the Python directories of the OS. The issue could be related to having duplicate files from older installations lying around, some of which might be found first during loading because of precedence in a path variable. I'm trying to completely remove opencog from my system now for a fresh installation. I think the error was not present in a previous installation that might have been cleaner.
Yep. This affects all atom-type files. ldd -rd
to view. Since there's an easy work-around (just load modules in normal order), this bug has low impact. (This comment is for myself...)
Closing. The answer is to link to the ${ATOMSPACE_LIBRARIES}
to pick up everything that is needed.