3

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).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nick Kolyshkin
  • 69
  • 1
  • 1
  • 5
  • 1
    What do you get if you do `python -m pip install numpy`? – AlexVestin Jul 30 '19 at 11:40
  • checked your environment variable 'path' under the system settings? are python/scripts etc. folders specified correctly? – FObersteiner Jul 30 '19 at 11:52
  • you have to install numpy using pip3 since you are using python3 – Nagaraju Jul 30 '19 at 11:54
  • @Nagaraju: I think this applies for Linux, where Python 2 ships with the distribution. Not necessary on Windows afaik. But well... maybe give it a try. – FObersteiner Jul 30 '19 at 11:55
  • [check](https://stackoverflow.com/questions/41501636/how-to-install-pip3-on-windows) this question @MrFuppes – Nagaraju Jul 30 '19 at 11:58
  • @Nagaraju, thanks for the link. As the question there states, Py2 is used in combination with Py3 installations. Not the case for this question. Also, on my Windows machine where I only run Py3, I never had to call `pip` as `pip3`. But I'd rather not be 100% sure so as I wrote, give it a try. – FObersteiner Jul 30 '19 at 12:02
  • @MrFuppes you are right. That is worth a try. – Nagaraju Jul 30 '19 at 12:04
  • @AlexVestin, with "python -m pip install numpy" same result as above in my question. – Nick Kolyshkin Jul 30 '19 at 12:08
  • @Nagaraju, tryed "pip3", same result. >check this question MrFuppes - tryed type "where python" in console, result >c:\program files (x86)\python37-32\python.exe Thanks for replies. – Nick Kolyshkin Jul 30 '19 at 12:10
  • Could it be because you installed a 32 bit version of Python? – Praind Jul 30 '19 at 12:16
  • Hey are you sure you got the error in the line 'import numpy'. Just making sure. – Fasty Jul 30 '19 at 12:16
  • 3
    Possible duplicate of [How to install numpy on windows using pip install?](https://stackoverflow.com/questions/29499815/how-to-install-numpy-on-windows-using-pip-install) – Chris Mueller Jul 30 '19 at 12:27
  • 1
    @Praind, thanks you very much, I was stupid. There is no problem in 32-bit version of Python, but few days ago I installed 64-bit version together with Visual Studio, not for purpose. Uninstalled it and now everything is fine. – Nick Kolyshkin Jul 30 '19 at 12:27
  • You're welcome, glad you found the issue! – Praind Jul 30 '19 at 14:08
  • The canonical question for this problem (on Windows, as this question) may be *[Error "Import Error: No module named numpy" on Windows](https://stackoverflow.com/questions/7818811/)* (2011, 40 answers and 300 votes). – Peter Mortensen Aug 22 '22 at 15:09

2 Answers2

3

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

I uninstalled it, and now the problem is fixed.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nick Kolyshkin
  • 69
  • 1
  • 1
  • 5
1

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Chris Mueller
  • 6,490
  • 5
  • 29
  • 35