Bobjoesmith
Bobjoesmith

Reputation: 121

I get an “wrong ELF class” error trying to import a python library that uses swig

I have been trying to import a python library called dwave tabu which uses swig, but I have been experiencing some issues. When importing the package in python3, I get this result:

    >>>import tabu
    Traceback (most recent call last):
    File "/home/chip/.local/lib/python3.5/site-  packages/tabu/tabu_search.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
    File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 986, in _gcd_import
    File "<frozen importlib._bootstrap>", line 969, in   _find_and_load
    File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 577, in module_from_spec
    File "<frozen importlib._bootstrap_external>", line 914, in create_module
   File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
   ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64
   During handling of the above exception, another exception occurred:
   Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/home/chip/.local/lib/python3.5/site-packages/tabu/__init__.py", line 17, in <module>
   from tabu.tabu_search import TabuSearch
   File "/home/chip/.local/lib/python3.5/site-  packages/tabu/tabu_search.py", line 17, in <module>
   _tabu_search = swig_import_helper()
   File "/home/chip/.local/lib/python3.5/site-packages/tabu/tabu_search.py", line 16, in swig_import_helper
   return importlib.import_module('_tabu_search')
   File "/usr/lib/python3.5/importlib/__init__.py", line 126, in   import_module
   return _bootstrap._gcd_import(name[level:], package, level)
   ImportError: No module named '_tabu_search' 

I suspect that the error has something to do with swig, but I am unsure what to do to resolve it. Also It looks like is an error about may be caused by binary compiled for 64-bit linux, on a 32-bit installation, but I don’t know how to fix that issue. Any help would be greatly appreciated. Thanks

Upvotes: 0

Views: 2204

Answers (1)

Employed Russian
Employed Russian

Reputation: 213646

ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64

This error means: you are trying to load a 64-bit _tabu_search.so library into a 32-bit process. You must either use 64-bit python, or install a 32-bit version of the tabu_search package.

I suspect that the error has something to do with swig

No, SWIG has almost nothing to do with your problem.

Upvotes: 1

Related Questions