Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'numpy' But numpy module already installed

Error: enter image description here I have already installed numpy module(pip show numpy):

enter image description here this how it shows when i try to install numpy again enter image description here

I tried to import numpy module which is already installed but it throws ModuleNotFoundError

like image 805
Amith A G Avatar asked Sep 06 '25 17:09

Amith A G


1 Answers

This sounds like a classic case of multiple Python versions on the same machine.

Try a

pip --version

as well as a

python -m pip --version

and a

python --version

my guess is that the associated versions of Python are different (note the pip version won't be the same as the Python version: pip --version on my machine gives: 'pip 22.3.1 from /opt/homebrew/lib/python3.10/site-packages/pip (python 3.10)'). This is often the case where the user has an installed version, and the system comes with a version too; Macs often have this problem, for example.

My thoughts are to try

python -m pip install numpy

which should use a version of pip associated with the Python version you are using. If you want to play more with multiple Python versions, I recommend using pyenv or conda, which will allow multiple versions to be installed simultaneously with a better-defined separation.

like image 63
notastringtheorist Avatar answered Sep 10 '25 04:09

notastringtheorist