Sheldon
Sheldon

Reputation: 4633

ImportError when importing numpy under Spyder from within a Python 3.7 conda environment

I have created a conda environment named python3 on my Ubuntu virtual machine using:

conda create -n python3 python=3.7

I have installed several packages under this environment, including numpy. When typing conda list, numpy shows up:

enter image description here

When running Python from the terminal, I can import numpy just fine, but this is no longer the case when working under the Spyder IDE: I get the following error:

ImportError: No module named numpy

Just for the record, I have reinstalled Spyder3 from my conda environment (sudo apt-get install spyder3) and I am launching Spyder from within this environment.

Any idea what I am doing wrong?

Upvotes: 2

Views: 207

Answers (1)

James
James

Reputation: 36623

The apt-get installation of Spyder does not know about your conda environment. You should use conda to install Spyder to the environment. Activate the environment, then launch Spyder.

conda install -n python3 spyder
conda activate python3
spyder

Upvotes: 3

Related Questions