Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import NumPy on PyCharm

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.

like image 476
Pickeroll Avatar asked Feb 25 '16 09:02

Pickeroll


People also ask

How do I import libraries into PyCharm?

PyCharm can do both. Type the name of the package and hit Alt-Enter , then choose Install and Import package . PyCharm will do both: you'll see a notification during the installation, then the import will be generated in the right way, according to your project styles.


3 Answers

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

like image 106
Mert Cuhaci Avatar answered Oct 08 '22 05:10

Mert Cuhaci


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.

like image 23
mab Avatar answered Oct 08 '22 05:10

mab


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.

like image 6
Lucas Roberts Avatar answered Oct 08 '22 06:10

Lucas Roberts