1

I tried installing numpy using the command 'pip install numpy' and ran 'import numpy' but I received the error ModuleNotFoundError: No module named 'numpy' when I tried to re-run the code. After reading similar questions on SO, I ran pip3 install numpy, but since i already installed it, I received the message Requirement already satisfied.

NOTE: I have read other similar questions on SO, but none of them solve my problem.


Possible solution for future readers:

Like @Sampath mentioned in his answer, I had two versions of python installed. To solve the issue, I manually deleted all the installation files of the older version.

1 Answer 1

1

Welcome to SO!

  1. It is likely that there are 2 python versions(Python2.X and Python3.X) are installed in your system.
  2. pip is likely pointing to your Python2.X and so if you want to used libraries installed in this version ===> use python to run
  3. pip3 is pointing to your Python3.X, so use Python3 in your terminal to use this.

Note:

  • To know installed libraries in your python2 use pip freeze or pip3 freeze for Python3
  • In case, if you are getting error for Python3 as not then this is like to be system path issues.

If you are still having trouble, you learn more about Anaconda-Python which has a curated list of steps and guidelines that are easy for beginners too. Hope this helps!

Sign up to request clarification or add additional context in comments.

2 Comments

you're right, it seems as though there are two versions installed on my system. If I run a python file that uses NumPy on the command prompt with either 'python' or 'python3', the code executes perfectly without any errors. However, when i try running this same code on the IDLE, I receive a module error. Any thoughts on how I could fix this?
@Newbie123 - Glad to know! About IDEL, sorry I have no answer here. Recommendation - I use Pycharm Community Edition IDE to configure the python path to my project. So I now suggest using an IDE instead of IDLE, as they offer more features like TypeHinting, PEP8 checks, typo-errors, documentation,..etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.