Error importing scipy.sparse._sparsetools

匿名 (未验证) 提交于 2019-12-03 01:34:02

问题:

I'm working on a macbook pro trying to use the gensim package to do Word2Vec. I had used the model earlier in the week, but when I tried to resume using it, I was given an error regarding loading scipy. I tried loading only the specific model echoing the error message, and this is the same output:

>>> import scipy.sparse._sparsetools Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "//anaconda/lib/python2.7/site-packages/scipy/sparse/__init__.py", line 213, in <module>     from .csr import *   File "//anaconda/lib/python2.7/site-packages/scipy/sparse/csr.py", line 13, in <module>     from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \ ImportError: dlopen(//anaconda/lib/python2.7/site-packages/scipy/sparse/_sparsetools.so, 2): Symbol not found: __ZNSs4_Rep20_S_empty_rep_storageE   Referenced from: //anaconda/lib/python2.7/site-packages/scipy/sparse/_sparsetools.so   Expected in: dynamic lookup

I intall everything via pip, so nothing was specifically built on this mac. Any advice would be most appreciated.

System details:

  • Python 2.7.8 |Anaconda 2.1.0 (x86_64)| (default, Aug 21 2014, 15:21:46)
  • Mac OSX, Yosemite (10.10.5)
  • scipy 0.14.0

回答1:

Your issue is likely caused by a linking problem described in this github issue.

Since you are already using anaconda, probably the best strategy for you is to use compiled binaries instead of trying to compile with pip yourself.

The only two things you have to do is:

pip uninstall scipy conda install scipy


回答2:

I had this issue with python 3.7 on windows 10 for both x86 and x64 version. Using dependency walker I found msvcp120.dll is missing. Placing the same in python root folder solved the issue for me.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!