[PYTHON] [Error] Symbol not found: _PyUnicodeUCS2_Compare

environment

error

When I tried to use scikit-learn or gensim, I got an error.

File "test.py", line 6, in <module>
    from sklearn.feature_extraction.text import CountVectorizer
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/sklearn/base.py", line 9, in <module>
    from scipy import sparse
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/__init__.py", line 216, in <module>
    from .lil import *
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/lil.py", line 16, in <module>
    from . import _csparsetools
ImportError: dlopen(/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/_csparsetools.so, 2): Symbol not found: _PyUnicodeUCS2_Compare
  Referenced from: /usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/_csparsetools.so
  Expected in: flat namespace
 in /usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/_csparsetools.so

Solution

(Added on 2016/4/3) Comment from shuhei_f

Once you erase the Python you put in pyenv with pyenv uninstall 2.7.11, then add the option PYTHON_CONFIGURE_OPTS =" --enable-unicode = ucs2 "pyenv install 2.7.11``` It may work fine if you reinstall it.

Solved with!

However, I don't know the cause and it feels uncomfortable, so I wonder if I'll put python back in after a while.

Recommended Posts

[Error] Symbol not found: _PyUnicodeUCS2_Compare
Error: pg_config executable not found
Python Not Implemented Error
command not found: django-admin
Today's python error: HTTPError: 404 Client Error: Not Found for url:
ERROR: root: code for hash md5 was not found.
filter rollbar python 404 not found
When using pillow from PIL import Image, Symbol not found: _PyUnicodeUCS2_AsLatin1String
Exception: Jupyter command `jupyter-lab` not found.
Command is not found in sudo
Undefined symbol error when importing torchvision
Dealing with key not found error in pacstrap when installing Arch Linux
When the Linux command $ yum -y install gives an error (yum: command not found)