Reputation: 61
I am trying to import numpy, pandas and other packages, but every time I try, the error/problem emerges that 'ModuleNotFoundError: No module named 'numpy' '. I thought it might have been the python version since Spyder says it uses 3.8.2 python and I was on 3.8.8 per 'python -V'. Upon switching, it indicated, 'Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.8/site-packages (1.20.3)' and I still can't import numpy in Spyder.
Terminal:
(base) readinger:~ neuro$ python -V
Python 3.8.2
(base) readinger:~ neuro$
(base) readinger:~ neuro$
(base) readinger:~ neuro$ pip install numpy
Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.8/site-packages (1.20.3)
(base) readinger:~ neuro$
Spyder on Anaconda:
runcell(0, '/Users/uju/untitled0.py')
Traceback (most recent call last):
File "/Users/uju/untitled0.py", line 9, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy
Upvotes: 0
Views: 1102
Reputation: 9
Since you installed Spyder with Anaconda, please don't use pip to update it as that will break your installation.
Instead, run the following commands in a terminal:
conda update anaconda
conda install spyder=5.5.1
The Ananconda environment then should offer all libraries/packages it comes with that should be available to Spyder that you launch from Anaconda Navigator.
Upvotes: 0
Reputation: 3396
The main problem is caused by you installing numpy
on the terminal and not on Anaconda.
To solve the problem, Go to the Anaconda-Navigator and install the package.
Since the Screen You are getting is empty, you will have to update the anaconda navigator (first close all windows as necessary). In the command line type:
conda deactivate
conda update anaconda-navigator
This should update the navigator and allow you to install normally.
Alternatively, you can just install numpy from anaconda in the terminal:
conda install numpy
Upvotes: 0