gmarcais/Jellyfish

Cannot import jellyfish in python

Strideradu opened this issue · 3 comments

Follow the binding tutorail in the jellyfish page to build with python bindings, but when I try to import jellyfish got the following error

>>> import jellyfish
Traceback (most recent call last):
  File "swig/python/dna_jellyfish.py", line 20, in swig_import_helper
  File "/mnt/home/dunan/anaconda/envs/python3/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named '_dna_jellyfish'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/home/dunan/lib/python3.6/site-packages/jellyfish.py", line 4, in <module>
    import dna_jellyfish as jellyfish
  File "swig/python/dna_jellyfish.py", line 23, in <module>
  File "swig/python/dna_jellyfish.py", line 22, in swig_import_helper
  File "/mnt/home/dunan/anaconda/envs/python3/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_dna_jellyfish'

Same issue to report here, with Python 2.7.

I get the same error with python 3.6 running the following commands

wget https://github.com/gmarcais/Jellyfish/releases/download/v2.2.10/jellyfish-2.2.10.tar.gz
tar xzf jellyfish-2.2.10.tar.gz
cd jellyfish-2.2.10.tar.gz
./configure --enable-python-binding --enable-swig
make -j 4
sudo make install
python3.6 -c 'import jellyfish'

Looking around for what I could be missing...

Edit: the same thing still happens when I specify a --prefix and alter the PYTHONPATH afterward.

Update: I fixed this by following the swig installation instructions, as the bindings during compile didn't seem to work for me. However, I had to add a line not mentioned there--

export PKG_CONFIG_PATH=/path/to/untarred/jellyfish-2.2.10

then run the whole cd swig/python; python setup build;...
This came up because running the python setup build complained with

Package jellyfish-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `jellyfish-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'jellyfish-2.0' found