Reputation: 978
I'm trying to import NumPy on PyCharm.
Using the PyCharm terminal and Miniconda I've launched the command:
conda install numpy
And this was the output:
Fetching package metadata: ....
Solving package specifications: ....................
# All requested packages already installed.
# packages in environment at C:\Users\...\Miniconda3:
#
numpy 1.10.4 py35_0
So I run my project but the terminal said:
ImportError: No module named 'numpy'
On my project bar I can see two different folders, the one with my project and another one with the external libraries.
Under External libraries
>
Extendend definitions
there is a NumPy folder so I guess that the installation goes well.
Upvotes: 35
Views: 209539
Reputation: 61
I have encountered problem installing numpy package to pycharm and finally figured out. I hope it would be helpful for someone having the same problem in installing numpy and other packages on pycharm.
Pycharm Setting :
Go to File => Setting => Project => Project Interpreter. On this window select the appropriate project interpreter. After this, a list of packages under the selected project interpreter will be shown. From the list select pip and check if the version column and the latest version column are the same. If different upgrade the version to the latest version by selecting the pip and using the upward triangle sign on the right side of the lists. Once the upgrading completed successfully, you can now add new packages from the plus sign.
I hope this would be clear and useful for someone.
Upvotes: 5
Reputation: 66
In general, the cause of the problem could be the following:
You started a new project with the new virtual environment. So probably you install numpy from the terminal, but it is not in your venv. So
either install it from PyCahrm Interface: Settings -> Project Interpreter -> Add the package
or activate your venv and -> pip install numPy
Upvotes: 0
Reputation: 846
Go to
if it doesnt work this can help you:
https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html
Upvotes: 73
Reputation: 71
I added Anaconda3/Library/Bin
to the environment path and PyCharm no longer complained with the error.
Stated by https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001194720/comments/360000341500
Upvotes: 0
Reputation: 305
Another option is to open the terminal at the pycharm & install it with pip
sudo pip install numpy
Upvotes: 0
Reputation: 1343
It seems that each project may have a separate collection of python libraries in a project specific computing environment. To get this working with numpy
I went to the terminal at the bottom of the pycharm window and ran pip install numpy
and once the process finished running the install and indexing my python project was able to import numpy from the line of code import numpy as np
. It seems you may need to do this for each project you setup in numpy.
Upvotes: 6
Reputation: 2782
In PyCharm go to
C:\Miniconda3\envs\my_env\python.exe
, where my_env is the environment you want to useAlternatively, in step 3 use C:\Miniconda3\python.exe
if you did not create any further environments (if you never invoked conda create -n my_env python=3
).
You can get a list of your current environments with conda info -e
and switch to one of them using activate my_env
.
Upvotes: 23