python-crfsuite icon indicating copy to clipboard operation
python-crfsuite copied to clipboard

Import Error

Open kasthuribh opened this issue 10 years ago • 12 comments


ImportError Traceback (most recent call last) in () 9 import sklearn 10 ---> 11 import pycrfsuite 12 13

/usr/local/lib/python2.7/dist-packages/pycrfsuite/init.py in () 1 from future import absolute_import ----> 2 from ._pycrfsuite import *

ImportError: /usr/local/lib/python2.7/dist-packages/pycrfsuite/_pycrfsuite.so: undefined symbol: _PyUnicodeUCS4_AsDefaultEncodedString

kasthuribh avatar Aug 15 '15 11:08 kasthuribh

What operating system are you using?

fgregg avatar Dec 14 '16 16:12 fgregg

Having a similar problem and I am on Ubuntu 16.04. Here is the problem:

import pycrfsuite Traceback (most recent call last): File "", line 1, in File "/home/softwares/anaconda3/lib/python3.6/site-packages/pycrfsuite/init.py", line 2, in from ._pycrfsuite import * ImportError: /home/softwares/anaconda3/lib/python3.6/site-packages/pycrfsuite/_pycrfsuite.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZTVNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE

ntugce avatar Mar 06 '17 12:03 ntugce

@ntugce are you mixing anaconda-installed packages and pip-installed packages?

kmike avatar Mar 06 '17 14:03 kmike

Thanks for your quick response. I did not do anything particular than pip installing the python-crfsuite Pip installation works but then when I want to import pycrfsuite I get this error. Googling it I found this issue. But "conda install libgcc" did not do it for me.

ntugce avatar Mar 06 '17 15:03 ntugce

Okay, easy_installing the egg file worked for me, as you said perhaps something went wrong with the pip packaging. Thank you !

ntugce avatar Mar 07 '17 08:03 ntugce

Sorry, I've tried to use the easy install method but It just doesn't seem to want to work for me. Traceback (most recent call last): File "C:/Users/dmurphy1/AppData/Local/Programs/Python/Python36-32/Lib/site-packages/usaddress/init.py", line 17, in import pycrfsuite File "C:\Users\dmurphy1\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pycrfsuite_init_.py", line 2, in from ._pycrfsuite import * ImportError: DLL load failed: The specified module could not be found.

Process finished with exit code 1

It seems like this has been an issue for a while but everybody who's figured it out doesn't have an reason why it starts to work all of a sudden. I've tried installing from whl and egg (pip & easy_install) any advice?

murphyd2 avatar Aug 22 '18 13:08 murphyd2

@murphyd2 something seems to be wrong with paths, as usaddress is installed for Python 3.6, while pycrfsuite is installed for Pythoin 3.7. I don't have much Windows experience, but I think they shouldn't both be in PYTHONPATH.

kmike avatar Aug 22 '18 13:08 kmike

(by the way thanks for the quick response) import fail.txt Hmm okay so I uninstalled them from both interpreters and reinstalled from whl files (all using pip) and i'm still getting this error.

murphyd2 avatar Aug 22 '18 13:08 murphyd2

@murphyd2 could you try creating a virtualenv, and installing python-crfsuite there, to make sure you're starting from a clean state?

kmike avatar Aug 22 '18 13:08 kmike

yep! I'll get back to you with the results pronto.

murphyd2 avatar Aug 22 '18 14:08 murphyd2

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

(venv) C:\Users\dmurphy1\Desktop\Python\Geocoding\venv>py -m pip install usaddress
Collecting usaddress
  Using cached https://files.pythonhosted.org/packages/d3/6c/3da44f6f41834cd4c2c0fadf29d11e8493bcf80811f5bd9ec542a08b9996/usaddress-0.5.10-py2.py3-none-an
y.whl
Collecting probableparsing (from usaddress)
  Using cached https://files.pythonhosted.org/packages/e1/6b/91255cbf739a835df41af530a36798397d70342d152b773b5b0fe3001843/probableparsing-0.0.1-py2.py3-no
ne-any.whl
Collecting future>=0.14 (from usaddress)
  Using cached https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.gz
Collecting python-crfsuite>=0.7 (from usaddress)
  Using cached https://files.pythonhosted.org/packages/24/f7/0a423a20520ad7c80c9564e00fc1335d66b59d8bf9b9b73ea80f79c96470/python_crfsuite-0.9.6-cp37-cp37m
-win32.whl
Installing collected packages: probableparsing, future, python-crfsuite, usaddress
  Running setup.py install for future ... done
Successfully installed future-0.16.0 probableparsing-0.0.1 python-crfsuite-0.9.6 usaddress-0.5.10
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(venv) C:\Users\dmurphy1\Desktop\Python\Geocoding\venv>py
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import usaddress
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\dmurphy1\Desktop\Python\Geocoding\venv\lib\site-packages\usaddress\__init__.py", line 16, in <module>
    import pycrfsuite
  File "C:\Users\dmurphy1\Desktop\Python\Geocoding\venv\lib\site-packages\pycrfsuite\__init__.py", line 2, in <module>
    from ._pycrfsuite import *
ImportError: DLL load failed: The specified module could not be found.
>>>

So, I'm still running into errors. FYI within site-packages for pycrfsuite (photo at end) I only have __pycache __, logparser,dumpparser, __ init, and then a PYD file called _pycrfsuite.cp37-win32 I'm assuming the end of _pycrfsuite is intentional there? Within __pycache __ i've got cpython files for only __init __ _logparser and _dumpparser.

Any thoughts?

issue

murphyd2 avatar Aug 22 '18 14:08 murphyd2

@kmike I fixed this by installing with miniconda in a conda enviroment with python 3.6. works great. Thanks!

murphyd2 avatar Aug 24 '18 15:08 murphyd2