Importing SciPy or scikit-image, “from scipy.linal

2019-04-19 14:14发布

问题:

I'm importing:

from scipy import misc, io 

But I get these errors:

Traceback (most recent call last):
  File "C:\work_asaaki\code\generateProposals.py", line 20, in <module>
    from scipy import misc, io
  File "C:\Python27\lib\site-packages\scipy\misc\__init__.py", line 47, in <module>
    from scipy.special import comb, factorial, factorial2, factorialk
  File "C:\Python27\lib\site-packages\scipy\special\__init__.py", line 548, in <module>
    from .basic import *
  File "C:\Python27\lib\site-packages\scipy\special\basic.py", line 17, in <module>
    from . import orthogonal
  File "C:\Python27\lib\site-packages\scipy\special\orthogonal.py", line 90, in <module>
    from scipy import linalg
  File "C:\Python27\lib\site-packages\scipy\linalg\__init__.py", line 159, in <module>
    from .misc import *
  File "C:\Python27\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
    from . import blas
  File "C:\Python27\lib\site-packages\scipy\linalg\blas.py", line 145, in <module>
    from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
Exception in thread Thread-1 (most likely raised during interpreter shutdown):

I'm running 64-bit Windows 7, and Python 2.7, In Anaconda's Spyder. I've tried the following:

pip install scipy-stack # this couldn't find any downloads that satisfy scipy-stack
pip install _fblas # this wasn't found
pip install ipython # this was successful
pip install scikit-learn # this was successful
pip install scipy # this was successful

I tried downloading SciPy and SciPy-Stack and scitkit-image from http://www.lfd.uci.edu/~gohlke/pythonlibs/ but I don't know what's wrong - it seems all the links are broken. My download always fails midway. Is there any way out of this? (Without having to re-install Anaconda Spyder from scratch)?

回答1:

For those who the previous answer doesn't solve the problem, take a look at the answer for this question: https://stackoverflow.com/a/17511983/1407575

Worked for me!



回答2:

I solved this problem on Windows 8.1 by installing Scipy‑stack‑14.8.27.win32‑py2.7.exe.

Apparently, scipy‑0.14.0.win32‑py2.7.exe was missing something.



回答3:

I had the same problem and installing of the latest version of NumPy+MKL from http://www.lfd.uci.edu/~gohlke/pythonlibs/ helped me. By the way, strangely I couldn't install the .whl file via wheel, but installing via pip worked.



回答4:

In my case, I got this error when I run

from sklearn import datasets
iris = datasets.load_iris()

I solve this by updating scipy from 0.16.0-np110py27_0 to 0.17.1-np110py27_1

conda update scipy

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
mkl-11.3.3                 |                1       110.0 MB
python-2.7.12              |                0        23.5 MB
conda-env-2.5.1            |           py27_0          67 KB
ruamel_yaml-0.11.7         |           py27_0         201 KB
conda-4.1.9                |           py27_0         245 KB
numexpr-2.4.4              |      np110py27_0         120 KB
scipy-0.17.1               |      np110py27_1        11.5 MB
scikit-learn-0.16.1        |      np110py27_0         3.5 MB
------------------------------------------------------------
                                       Total:       149.1 MB

The following NEW packages will be INSTALLED:

mkl:          11.3.3-1
ruamel_yaml:  0.11.7-py27_0

The following packages will be UPDATED:

conda:        4.0.7-py27_0       --> 4.1.9-py27_0
conda-env:    2.4.5-py27_0       --> 2.5.1-py27_0
numexpr:      2.3.1-np19py27_0   --> 2.4.4-np110py27_0
python:       2.7.11-4           --> 2.7.12-0
scikit-learn: 0.15.2-np19py27_0  --> 0.16.1-np110py27_0
scipy:        0.16.0-np110py27_0 --> 0.17.1-np110py27_1


回答5:

Search for your Numpy+MKL version as described here.

This worked for me:

python - m pip install xxx


回答6:

In my case, this solution is working.

window 10 64 bit, Python 3.6.3

  1. delete Numpy and Scipy
  2. download window binaries of Numpy and Scipy from https://www.lfd.uci.edu/~gohlke/pythonlibs/
  3. install Numpy and Scipy
  4. pip3 install scipy-stack

Then, it is working.



回答7:

this worked for me

conda update scipy

... The following NEW packages will be INSTALLED:

icc_rt:       2017.0.4-h97af966_0
intel-openmp: 2018.0.0-8

The following packages will be UPDATED:

conda:        4.3.34-py36_0       conda-forge --> 4.5.0-py36_0
conda-env:    2.6.0-0             conda-forge --> 2.6.0-h36134e3_1
mkl:          2017.0.1-0                      --> 2018.0.2-1
numexpr:      2.6.1-np111py36_2               --> 2.6.4-py36h30784b8_0
numpy:        1.11.3-py36_0                   --> 1.11.3-py36h4a99626_4
pycosat:      0.6.1-py36_1                    --> 0.6.3-py36h413d8a4_0
scikit-learn: 0.18.1-np111py36_1              --> 0.19.1-py36h53aea1b_0
scipy:        0.18.1-np111py36_1              --> 1.0.0-py36h1260518_0

Proceed ([y]/n)? y

To test, I typed python

from scipy import signal



回答8:

I faced the similar issue while working with statsmodels package for time series analytics. I am using Anaconda 3.X distribution. May of the answers pointing to install the numpy again form the mkl distribution after uninstalling the regular one.

That might be a good idea but i dont want to disturb my current environment, so i have create a new python virtual environment and installed packages using pip in the following order numpy>>scipy>>statsmodels

This did worked for me.