Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting numpy to import in Python (Pycharm), Anaconda installed

I am very new to python and I am trying to write a code to derive a first-order ODE. Because of this, I need certain packages (ex. numpy) to do this and installed Anaconda.

When I tried to use the "import numpy" command in PyCharm, it did not work. I got ModuleNotFoundError: No module named 'numpy'.

I am very new and need all the help I can get to get the programs linked.

Thank you!

like image 571
Nicole I. Avatar asked Sep 07 '25 14:09

Nicole I.


2 Answers

The best practice is to use a separate Conda environment for each of your projects, and then install what you need for your project in those.

First, open Settings, and go to Project Settings | Project Interpreter. Then use the gear icon on the top right, and choose to add a new local interpreter:

Add a new local interpreter

Then, choose 'Conda Environment' on the left-hand side, and make sure to choose the Python version you want (if you're not sure, 3.6 is a good choice).

Create a new Conda environment

Finally, use the green '+' icon on the interpreter page to install a new package, just look for 'Numpy' and install it from the dialog there:

Install Numpy

like image 76
Ernst Avatar answered Sep 10 '25 06:09

Ernst


You need to set your project interpreter to the python, that came with your anaconda installation.

Your installation path may differ from mine.

For a new project: new project settings

If you want to change the settings for an existing project: project settings for existing project

like image 33
Alex bGoode Avatar answered Sep 10 '25 07:09

Alex bGoode