Aritra Roychowdhury
Aritra Roychowdhury

Reputation: 11

Error when importing NumPy in PyCharm

I have installed NumPy using pip install and it's working fine while using it in the python interpreter on the command line. But whenever I try import numpy in PyCharm it throws an error module not found.

I already set the right path in the project interpretor and the import numpy command is working fine with other IDEs such as Syder or Jupyter notebook but it doesn't work in PyCharm.

Upvotes: 0

Views: 2177

Answers (2)

Nancy Wahl
Nancy Wahl

Reputation: 11

I found a YouTube video that worked for me in importing a package into PyCharm. First, click on the File menu, then click on Settings, then click on Project Interpreter. Look for a + sign to the right and click on that. That allows you to add a package. Then search for your package of choice (I wanted numpy) in the Search bar at the top. Click on the name, and then at the bottom click on Install Package. After a few minutes, it will say, package successfully installed, and sure enough it was. I was able to import numpy the usual way in PyCharm.

Upvotes: 1

nyanpasu64
nyanpasu64

Reputation: 3135

Did you install official Python or Anaconda/Miniconda?

I assume PyCharm created either a virtualenv or a conda env, or an isolated Python environment that does not have NumPy installed.

You should either use your global environment instead of virtualenv:

Or install NumPy in your virtualenv or conda env.

  • This is more complicated. If you open Terminal in PyCharm and it says (project-name) in your prompt, try pip install numpy.

Upvotes: 0

Related Questions