Nick Kolyshkin
Nick Kolyshkin

Reputation: 69

Error "ModuleNotFoundError: No module named 'numpy'"; but NumPy is installed

NumPy is installed via pip in Windows 7 64 bit, Python 3.

When trying to run code in the console (Far Manager), I have an error:

Traceback (most recent call last):
 File "[path]\X.py", line 42, in <module>
  import numpy
ModuleNotFoundError: No module named 'numpy'

I tried to install NumPy, but I failed, because it was already installed:

pip install numpy

Requirement already satisfied: numpy in c:\program files (x86)\python37-32\lib\site-packages (1.17.0)

This is exactly the right folder, and all other libraries work in it correctly. I tried to uninstall NumPy and then install again via pip, but nothing changed.

Checking Python version python -- version

Python 3.7.3

Checking pip version pip -V

pip 19.2.1 from c:\program files (x86)\python37-32\lib\site-packages\pip (python 3.7)

There is no other Python version on my computer. I'm not sure but maybe numpy used to work before I installed matplotlib (via pip, of course).

Upvotes: 3

Views: 15242

Answers (2)

Nick Kolyshkin
Nick Kolyshkin

Reputation: 69

I was wrong. There was another Python version, 64-bit, in the Visual Studio folder.

I uninstalled it, and now the problem is fixed.

Upvotes: 3

Chris Mueller
Chris Mueller

Reputation: 6680

The PyPI NumPy package, which is automatically downloaded by pip, does not install correctly on Windows 7. I usually recommend that people install Python using the Anaconda distribution, because it comes with NumPy pre-installed.

Since you already have the Python interpreter installed, you can download the NumPy wheel from Christoph Gohlke's page and install it that way. Be sure to use pip to uninstall the current non-working version first.

Have a look at this Stack Overflow question, and specifically this answer for more details.

Upvotes: 1

Related Questions