ybdesire
ybdesire

Reputation: 1713

import scipy.sparse failed

My python is 3.5.1 (32-bit) at Win7 (32-bit). I've installed 'scipy-0.16.1-cp35-none-win32.whl' and 'numpy-1.10.2+mkl-cp35-none-win32.whl' downloaded form http://www.lfd.uci.edu/~gohlke/pythonlibs/. And the scipy model can be imported correctly as below:

import scipy

But I get the errors when importing scipy.sparse:

>>> import scipy.sparse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\sparse\__init__.py", line 213, in <module>
    from .csr import *
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\sparse\csr.py", line 13, in <module>
    from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
ImportError: DLL load failed: The specified module could not be found.

And I got the error below by installing scipy by pip:

pip install scipy


Command 
  "c:\users\administrator\appdata\local\programs\python\python35-32\python.exe -c \
  """import setuptools, tokenize;
  __file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-qzcp2rwj\\scipy\\s‌​etup.py';
  exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))""" \
  install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-lyz7f9x_-record\install-record.txt \
  --single-version-externally-managed --compile"
failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-qzcp2rwj\scipy

How can I correctly import scipy.sparse?

Upvotes: 2

Views: 3666

Answers (1)

ybdesire
ybdesire

Reputation: 1713

Fixed this issue by installing python 3.4 and 3.4 dependencies from http://www.lfd.uci.edu/~gohlke/pythonlibs/. It seems the error only reproduced by python 3.5 environment.

The correct environment configurations are:

  • OS: Win7 (32-bit)
  • Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
  • scipy-0.17.0rc1-cp34-none-win32.whl
  • numpy-1.10.2+mkl-cp34-none-win32.whl

Upvotes: 1

Related Questions