Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named _permutohedral #1

Open
molyswu opened this issue May 26, 2017 · 11 comments
Open

ImportError: No module named _permutohedral #1

molyswu opened this issue May 26, 2017 · 11 comments

Comments

@molyswu
Copy link

molyswu commented May 26, 2017

Hi,
python main_example.py
Traceback (most recent call last):
File "main_example.py", line 5, in
import CRFRNN
File "/home/molys/product/NER/CRF-RNN_Tensorflow/CRFRNN.py", line 8, in
import permutohedral
File "/home/molys/product/NER/CRF-RNN_Tensorflow/permutohedral.py", line 17, in
_permutohedral = swig_import_helper()
File "/home/molys/product/NER/CRF-RNN_Tensorflow/permutohedral.py", line 16, in swig_import_helper
return importlib.import_module('_permutohedral')
File "/usr/lib64/python2.7/importlib/init.py", line 37, in import_module
import(name)
ImportError: No module named _permutohedral

@0ohadeso0
Copy link

hi, i have the same problem. Did you fix that?

@liangy1969
Copy link
Owner

The code runs with no problem on my personal computer and the computer in my office. The lib is complied under win64, so that might be the cause.
Anyway, I will upload the source files of the lib in the following days so that you can compile them by yourself.

@onurbarut
Copy link

onurbarut commented Oct 4, 2017

hi, while running setup.py I get the following error. do you have any idea?

onur@onur-GE62VR-6RF:~/tf_kodlar/CRF-RNN_Tensorflow-master/src$ python3 setup.py build_ext --inplace
running build_ext
building '_permutohedral' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/lib/python3.5/Lib/site-packages/numpy/core/include -I/usr/include/python3.5m -c permutohedral_wrap.cxx -o build/temp.linux-x86_64-3.5/permutohedral_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
permutohedral_wrap.cxx: In function ‘PyObject* _wrap_PermutohedralLattice_get_enclosing_simplices(PyObject*, PyObject*)’:
permutohedral_wrap.cxx:4056:10: error: invalid conversion from ‘long long unsigned int*’ to ‘size_t* {aka long unsigned int*}’ [-fpermissive]
arg2 = (unsigned long long*) array_data(array2);
^
permutohedral_wrap.cxx: In function ‘PyObject* _wrap_PermutohedralLattice_get_blur(PyObject*, PyObject*)’:
permutohedral_wrap.cxx:4166:10: error: invalid conversion from ‘long long unsigned int*’ to ‘size_t* {aka long unsigned int*}’ [-fpermissive]
arg2 = (unsigned long long*) array_data(array2);
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Thanks for the code.

@liangy1969
Copy link
Owner

What is the numpy version you are using?

@onurbarut
Copy link

it is 1.13.3. if you need, i use python3.5. If you would like to check it out, I asked a question in stackoverflow, with a little more detail explained. https://stackoverflow.com/questions/46593778/building-crf-rnn-tensorflow-implementation

@liangy1969
Copy link
Owner

You can try installing the following packages:
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

I am not sure whether it can work, but you can have a try.

@onurbarut
Copy link

onurbarut commented Oct 8, 2017 via email

@liangy1969
Copy link
Owner

Try changing '$PYTHON_PATH/Lib/site-packages/numpy/core/include' to '/usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy', or the folder that contains the header files of numpy in your python directory.

@onurbarut
Copy link

I did, actually I modified setup with import and np.get_include() instead of whole pathname. No use, same error remains :(

@liangy1969
Copy link
Owner

Probably the 'permutohedral_wrap.cxx' you generated using swig is not correct. Try using the following one
permutohedral_wrap.txt
Change the suffix to cxx

@onurbarut
Copy link

You are correct. The problem seems to be solved. I will let you know when I truly train the CRF. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants