Import NumPy on PyCharm

151,122

Solution 1

Go to

  1. ctrl-alt-s
  2. click "project:projet name"
  3. click project interperter
  4. double click pip
  5. search numpy from the top bar
  6. click on numpy
  7. click install package button

if it doesnt work this can help you:

https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html

Solution 2

In PyCharm go to

  1. File → Settings, or use Ctrl + Alt + S
  2. < project name > → Project Interpreter → gear symbol → Add Local
  3. navigate to C:\Miniconda3\envs\my_env\python.exe, where my_env is the environment you want to use

Alternatively, 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.

Solution 3

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.

Solution 4

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 : 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.

enter image description here

I hope this would be clear and useful for someone.

Share:
151,122
Pickeroll
Author by

Pickeroll

Updated on March 27, 2021

Comments

  • Pickeroll
    Pickeroll about 3 years

    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.