1

After uninstalling Anaconda to stop problems with Jupyter notebook kernels, I am trying to run a file which requires

from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import LogNorm
from matplotlib import animation
from IPython.display import HTML
from autograd import elementwise_grad, value_and_grad
from scipy.optimize import minimize
from collections import defaultdict
from itertools import zip_longest
from functools import partial

and getting this message:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-29781769facb> in <module>()
     10 
     11 from autograd import elementwise_grad, value_and_grad
---> 12 from scipy.optimize import minimize
     13 from collections import defaultdict
     14 from itertools import zip_longest

c:\python27\lib\site-packages\scipy\__init__.py in <module>()
     59 __all__ = ['test']
     60 
---> 61 from numpy._distributor_init import NUMPY_MKL  # requires numpy+mkl
     62 
     63 from numpy import show_config as show_numpy_config

ImportError: cannot import name NUMPY_MKL

I tried installing scipy.optimize:

C:\Users\Toni>pip install scipy.optimize
Collecting scipy.optimize
Could not find a version that satisfies the requirement scipy.optimize (from versions: )
No matching distribution found for scipy.optimize

I'm using Windows 10 on a 64-bit computer, and python 2.7.13.

I did try the following:

>C:\Users\Toni>pip install scipy
Requirement already satisfied: scipy in c:\python2/\lib\site-packages
Requirement already satisfied: numpy>=1.8.2 in c:\python2/\lib\site-package (from scipy)

PROGRESS NOTES:

OK... It seems as though scipy may have been incorrectly installed (following the lead from the first answer)... So I uninstall it, and then try...

pip install scipy

failed with error code 1 in c:\users\toni\appdata\local\temp\pip-build-vnjyae\scipy

which sends me here, and later on here, but not so fast, first stop here with the conundrum of which one to choose:

NumPy, a fundamental package needed for scientific computing with Python.
Numpy+MKL is linked to the Intel® Math Kernel Library and includes required DLLs in the numpy.core directory.
numpy‑1.11.3+mkl‑cp27‑cp27m‑win32.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win32.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win32.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win32.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win_amd64.whl
numpy‑1.13.0+mkl‑cp27‑cp27m‑win32.whl
numpy‑1.13.0+mkl‑cp27‑cp27m‑win_amd64.whl
numpy‑1.13.0+mkl‑cp34‑cp34m‑win32.whl
numpy‑1.13.0+mkl‑cp34‑cp34m‑win_amd64.whl
numpy‑1.13.0+mkl‑cp35‑cp35m‑win32.whl
numpy‑1.13.0+mkl‑cp35‑cp35m‑win_amd64.whl
numpy‑1.13.0+mkl‑cp36‑cp36m‑win32.whl
numpy‑1.13.0+mkl‑cp36‑cp36m‑win_amd64.whl

And here is the key (probably):

Typing python on the cmd prompt I get:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win 32

So from Python 2.7, I need the 27 version, and from win 32 I have to disregard the fact that I have a 64-bit computer. So clear...

Antoni Parellada
  • 4,253
  • 6
  • 49
  • 114
  • try just `pip install scipy` – Hans Jun 10 '17 at 00:31
  • @kamik423 Thank you. I tried (edited OP), and curiously it seems as though it is already installed!!! So I have even less of a clue as to why this doesn't work... – Antoni Parellada Jun 10 '17 at 00:37
  • This helped me installing scipy/numpy on windows: https://stackoverflow.com/a/2114531/3554071 – engineercoding Jun 10 '17 at 00:38
  • @engineercoding I thought I had accomplished this by running: `C:\Users\Toni>pip install numpy-1.11.3+mkl-cp2/-cp2/m-win32.whl` returning `Requirement already satisfied: numpy==1.11.3+mkl from file:///C:/Users/Toni/numpy-1.11.3%2Bmkl-cp27-cp27m-win32.whl in c:python27\lib\site-packages`. Am I not using the right wheel? – Antoni Parellada Jun 10 '17 at 00:51

1 Answers1

0

I've met some similar questions before, remind me that the module had alreadt been installed, but inside the folder it's almost empty. My solution is to

pip uninstall MODULENAME

Then try another way like reinstall or use wheel

pip install MODULENAME.whl

Hope that could help you.

Amarth Gûl
  • 1,040
  • 2
  • 14
  • 33
  • I may uninstall scipy in your case. The latest time I met this problem is about openCV, it told me opencv-python had been installed but it's not. So I uninstalled opencv-python, downloaded a offline wheel file and use it to install, restarted and it worked. – Amarth Gûl Jun 10 '17 at 03:02
  • OK. The package (module (?)) that is causing problems is more specific, though... I think it is `scipy.optimize`... – Antoni Parellada Jun 10 '17 at 03:06
  • Ummm... I'm not sure, in the openCV case I found that I do can `import cv2` but there's no sub-modules, so I uninstalled the entire `opencv-python`. – Amarth Gûl Jun 10 '17 at 03:10
  • it is a sub-folder of scipy. Thus I believe it is. – Amarth Gûl Jun 10 '17 at 03:13
  • After uninstalling `scipy`, and trying to reinstall it, I get a code 1 error, which seems to mean that I need to first [install a bunch of stuff](https://stackoverflow.com/a/30919488/4089351). The question is, for my Windows 10 64-bit computer, should I choose the `win32.whl` or `win_amd64.whl`. One would assume the latter, but it doesn't let me do it. So is it the former? – Antoni Parellada Jun 10 '17 at 03:26
  • I don't understand what is " it doesn't let me do it". I'm using 64-bit win10 either, and yet all `win_amd64` wheel file works well... If that doesn't suits you, I think [Anaconda](https://www.continuum.io/downloads) may help you, thought it may be a little large... – Amarth Gûl Jun 10 '17 at 03:44
  • I posted the issue with the links, illustrating how it's not about the computer (32 vs. 64-bit), but the version on Python. – Antoni Parellada Jun 10 '17 at 04:08
  • ... the version you need should be `scipy‑0.19.0‑cp27‑cp27m‑win_amd64.whl` from [here](http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy). But again, since many of these packages for science calculation are connected, I still recommend some full Python distribution like [Anaconda](https://www.continuum.io/downloads), [Pythonxy](https://python-xy.github.io/) or [Canopy](https://www.enthought.com/products/canopy/). It'll be much easier with them. – Amarth Gûl Jun 10 '17 at 06:59