Import Error: No module named numpy?

0 votes

The installation went fine but when I execute

import numpy

I got the following error:

Import error: No module named numpy

I know this is probably a super basic question, but I'm still learning.

Thanks

Apr 14 in Python by kartik
• 26,540 points
2,616 views

1 answer to this question.

0 votes

Hello,

I had numpy installed on the same environment both by pip and by conda, and simply removing and reinstalling either was not enough.

I had to reinstall both.

I don't know why it suddenly happened, but the solution was

pip uninstall numpy

conda uninstall numpy

uninstalling from conda also removed torch and torchvision.

then

conda install pytorch-cpu torchvision-cpu -c pytorch

and

pip install numpy

this resolved the issue for me.

answered Apr 14 by Niroj
• 57,260 points
conda uninstall numpy
conda install numpy

worked fine for me.

Related Questions In Python

0 votes
1 answer

Python error " import requests ImportError: No module named requests"

Hi @Vasgi, for the code you're trying ...READ MORE

answered Aug 5, 2019 in Python by Layla
7,100 views
0 votes
1 answer

import NumPy as np ImportError: No module named NumPy

Hi@akhtar, Whenever you import a module, python will ...READ MORE

answered Apr 9 in Python by MD
• 55,020 points
5,245 views
0 votes
1 answer

Python Requests module - Import Error: No module named requests

Run with Python 3 from the command ...READ MORE

answered Sep 11 in Python by Malik Brahimi
60 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,349 views
0 votes
0 answers
0 votes
1 answer

Error: import No module name urllib2

Hii, You have to install the modules like bs4, ...READ MORE

answered May 5 in Python by Niroj
• 57,260 points
318 views
0 votes
1 answer

Import error: No module name urllib2

As stated in the urllib2 documentation: The urllib2 module has been split ...READ MORE

answered May 11 in Python by Niroj
• 57,260 points
833 views