0

When I work in Jupyter Notebooks everything works fine, and I can import numpy and pandas successfully. However, when I try to download the script and then run it in an editor such as PyCharm or Atom, I get an import error: no module named numpy, and the same for pandas. How do I fix this? Is this due to the packages being installed in a different location than where I am downloading the code? Everything is installed with Anaconda, and when I try to do ```conda install numpy`` it tells me that all packages have already been installed.

noamchomsky
  • 103
  • 1
  • 4

2 Answers2

1

This may be because Pycharm and Atom are using your default python install rather than your anaconda python environment.

You can configure Pycharm to use your conda environment via (https://www.jetbrains.com/help/pycharm/conda-support-creating-conda-virtual-environment.html).

Sparrow0hawk
  • 517
  • 4
  • 13
0

Anaconda uses virtual conda environments to store the Python interpreter and libraries. If this isn't set up in your IDE, it won't see the libraries. This is described in this post: Use Conda environment in pycharm

Check your PyCharm interpreter options: File > Settings > Project > Project Interpreter. Make sure your desired Anaconda interpreter/environment is selected.

If your Anaconda environment isn't selected, click the Project Interpreter drop-down. if you see it there, select it. If not, click Show All... then + (Add) and browse to the Anaconda folder.

This post describes how to set up conda in Atom: Using anaconda environment in Atom

DV82XL
  • 5,350
  • 5
  • 30
  • 59