1

When I want to execute my script I got the error: ModuleNotFoundError: No module named 'numpy'. But the module is already installed as said me the answer to the install command:

C:\WINDOWS\system32>pip install numpy
Requirement already satisfied: numpy in c:\users\simeo\anaconda3\envs\tensorflow1\lib\site-packages (1.17.2)

I'm quite new with Python, so I don't understand why it's not working and what could be the problem.

I'm using Windows 10 (64 bits). I installed Python 3.7

Thanks in advance!

Dark Patate
  • 113
  • 2
  • 12
  • Are you sure that you have only one Python installation? – Michael Butscher Oct 08 '19 at 01:17
  • How can I check that? In my start folder I only have one Python. – Dark Patate Oct 08 '19 at 01:21
  • check the used python version in pip with `pip --version` and compare it with the version of python checked with `python --version`. – micharaze Oct 08 '19 at 01:26
  • 1
    pip version : 3.5 ; python version : 3.5.6 So it's not exactly same, and different from the version I have according my Python folder in start menu – Dark Patate Oct 08 '19 at 01:30
  • It should be the same because pip don't show the minor versions `.6`. – micharaze Oct 08 '19 at 01:46
  • Try to compare the path of the packages with `pip --version` and `python -m site`. – micharaze Oct 08 '19 at 01:49
  • Looks like you have anaconda as per your pip output. How did you install python 3.7? What's the output when you run `import sys; print(sys.executable)` –  Oct 08 '19 at 01:58
  • @raze92 : I got several paths with that command. Which one I have to check? @JustinEzequiel: I got that answer `C:/Users/simeo/AppData/Local/Programs/Python/Python37-32/python.exe h:/ProjetDev/Python/temp/test.py C:\Users\simeo\AppData\Local\Programs\Python\Python37-32\python.exe` I installed Python some months ago with the installer I found on Python website. – Dark Patate Oct 08 '19 at 02:36
  • For the same ***symptom***, 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:10

3 Answers3

0

For Windows try either two of these methods in cmd:

  1. pip3 install numpy

  2. pip3 install -U numpy

  3. directly download latest version from sourceforge.net

If you are using pycharm, it can not install numpy from interpreter settings. After one of above method works, try installing numpy in pycharm again through interpreter settings.

m02ph3u5
  • 3,022
  • 7
  • 38
  • 51
0

You need to upgrade your Numpy library. Your current Keras version is not compatible with your Numpy module. You can use the below-given command to upgrade Numpy.pip install -U numpy

-2

Try adding this to your code, above everything else:

import numpy