dirko / pyhcrf

A hidden conditional random field (HCRF) implementation in Python.
BSD 2-Clause "Simplified" License
27 stars 10 forks source link

Cannot import `pyhcrf` module #4

Closed jbschiratti closed 7 years ago

jbschiratti commented 7 years ago

After following the setup/build instructions given on the repo, I ran into the following error when I tried to import the pyhcrf module :

Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyhcrf
Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/cal/homes/jbschiratti/anaconda3/lib/python3.5/site-packages/pyhcrf-0.0.1-py3.5-linux-
x86_64.egg/pyhcrf/__init__.py", line 3, in <module>
        from .hcrf import Hcrf
    File "/cal/homes/jbschiratti/anaconda3/lib/python3.5/site-packages/pyhcrf-0.0.1-py3.5-linux-
x86_64.egg/pyhcrf/hcrf.py", line 11, in <module>
        from pyhcrf.algorithms import forward_backward, log_likelihood
ImportError: /cal/homes/jbschiratti/anaconda3/lib/python3.5/site-packages/pyhcrf-0.0.1-py3.5-
linux-x86_64.egg/pyhcrf/algorithms.cpython-35m-x86_64-linux-gnu.so: undefined symbol: 
npy_logaddexp

After a quick look on Internet, I found a similar issue (https://github.com/scikit-learn/scikit-learn/issues/7542). The problem seems originate from different installs of numpy. In my case, numpy was install with conda, not pip. Even after re-installing numpy or upgrading Cython the error remains.

dirko commented 7 years ago

I've never build or tested this package with Python 3. Do you get the same with 2.7?

jbschiratti commented 7 years ago

You're right, the problem goes away with Python 2.7. Thank you.

i3evelyn commented 5 years ago

How to modify the code in order to run with Python3?