6

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
j.a.gartner
  • 197
  • 2
  • 7
  • `from scipy import sparse` gives me asscess to `sparse._sparsetools`. With many `scipy` components the correct import is this `from ...` syntax. – hpaulj Sep 17 '15 at 01:15

2 Answers2

6

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
cel
  • 30,017
  • 18
  • 97
  • 117
  • Thanks for the reply, but this was not successful (exact same error). Could it be that I need to do something similar for a dependency? – j.a.gartner Sep 17 '15 at 17:13
  • if that did not work, you may want to add `which python`, also the output of `import(scipy); print(scipy)` – cel Sep 17 '15 at 17:32
  • which python-> //anaconda/bin/python print(scipy)-> it's clear that's the problem, I do not understand how to fix it though – j.a.gartner Sep 17 '15 at 21:33
  • I simply deleted the bad instance, and it self corrected. Thanks! – j.a.gartner Sep 17 '15 at 21:42
0

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.

Binoy Pilakkat
  • 150
  • 1
  • 6