pydensecrf
pydensecrf copied to clipboard
Unable to Import in conda environment, throws undefined symbol "PyFPE_jbuf" pydensecrf/densecrf.so. How to resolve?
I installed the library using pip and it was installed successfully. It works fine in root conda, but when I tried to access in one of conda environment it throws the following error:
/.local/lib/python2.7/site-packages/pydensecrf/densecrf.so: undefined symbol: PyFPE_jbuf
While initial search on google it ask for some conflict in numpy. I tried uninstalling and installing using pip but still the same issue. I would appreciate, if you can let me know for any clues to resolve this.
Thanks
Hmmm, I don't really use conda, but this user here had the exact same error and later replied that after restarting it worked. Can you try that?
Furthermore, I found this and the answers to this SO question. They all suggest that you have a mix-up between your conda and your system versions of python/Cython/pip and PyDenseCRF. You need to be consistent with these.
There is also the chance that I did something wrong with packaging, but I've done the same as forever, so I hope that should be all correct. Especially since you say it works fine in root conda but not in a conda env, this suggests even more that there is mixup in the env to me.
You could also try pip install git+https://github.com/lucasb-eyer/pydensecrf.git
to compile straight from the repo, to see if I made mistakes packaging.
Finally, if nothing helps, can you post the exact sequence of commands, starting from the beginning, for me to reproduce this?
I am having a similar problem in anaconda environment using Ubuntu 18.04. Steps to recreate the envronment using conda 4.3.30:
conda create --name test_env python=3.5
source activate test_env
pip install cython
pip install pydensecrf
I have tried installing from pypi, git, and conda-forge. All methods appear to have installed correctly and yield the same result. When I 'ls' see what got installed in the directory /libs/python3.5/site-packages/pydensecrf
, I see:
densecrf.cpython-35m-x86_64-linux-gnu.so
__init__.py
utils.py
eigen.cpython-35m-x86_64-linux-gnu.so
__pycache__
When I open a python interpreter from within my virtual environment, I see I am using 3.5.5. This appears to agree with the version indicated on the .so
files within the install directory. I can import pydensecrf, but only see the contents of __pycache__
folder. Any ideas on how to get the software properly installed?
@danhamill are you sure your problem is the same as the OP? It sounds different to me (edit: since you don't mention an "undefined symbol" error); if it is not the same, please open a separate issue.
Nevertheless, thanks for the very detailed info. I don't currently have conda on my machine anymore and am quite busy with other things, so not sure when I can find time to investigate this myself. Pull-requests welcome if anybody figures this out!
Does installing the Cython from anaconda (conda install -c anaconda cython
) make a difference?
And again, regarding the problem described in the OP, literally all Google search results for PyFPE_jbuf
indicate an error on the user's side, typically mixing up multiple enviroments/libraries from different environments.
For someone who is facing a similar issue, it is due to the conflict between conda installation and pip installation of the same module. I installed a pydensecrf within conda
conda install -c conda-forge pydensecrf
within my conda virtual environment. But there was another pip installation also existing on the system. The conda environment was pointing to the pip installation, hence the error. You can check that within python (Note that import is working but it will throw an error later on)
import pydensecrf as p
print (p.__path__)
I removed this installation using simple rm -rf /path/to/pip/installation/from/above/print
Now I check again with
import pydensecrf as p
print (p.__path__)
and it shows the path of the pydensecrf installation within my conda virtual environment which is consistent and the PyFPE_jbuf error goes away.