[python] Installing NumPy via Anaconda in Windows

I am trying to use Numpy in a Python 2.7.8 script in Windows. So, I download and installed the latest version of Anaconda (I also want to use some of the other tools in Anaconda) to the directory "C:/Anaconda". As default, I checked the boxing asking me if I wanted to add the path to the binary files to the Windows PATH.

After checking PATH, it contains the following: "C:\Anaconda;C:\Anaconda\Scripts".

Then, after installation I open a new Command Prompt, and in the Python envirnoment, I enter "import numpy", but this gives the error: "ImportError: No module named numpy".

What stage have I missed out in the installation process?

***** EDIT *****

I have just noticed that there is no file called "numpy" in either "C:\Anaconda" or "C:\Anaconda\Scripts". But according to the Anaconda website (http://docs.continuum.io/anaconda/pkg-docs.html), the installation should come with Numpy...

***** EDIT *****

It seems that Windows was running Python from an existing version of Python I had installed, which was not associated with NumPy. After deleting this, and running Python from the Anaconda installation, NumPy is now being recognised.

This question is related to python numpy anaconda

The answer is


Anaconda folder basically resides in C:\Users\\Anaconda. Try setting the PATH to this folder.


Yep you should start anaconda's python in order to use python libs which come with anaconda. Or otherwise you have to manually add anaconda\lib to pythonpath which is less trivial. You can start anaconda's python by a full path:

path\to\anaconda\python.exe

or you can run the following two commands as an admin in cmd to make windows pipe every .py file to anaconda's python:

assoc .py=Python.File
ftype Python.File=C:\path\to\Anaconda\python.exe "%1" %*

after this you'll be able just to call python scripts without specifying the python executable at all.


I had the same problem, getting the message "ImportError: No module named numpy".

I'm also using anaconda and found out that I needed to add numpy to the ENV I was using. You can check the packages you have in your environment with the command:

conda list

So, when I used that command, numpy was not displayed. If that is your case, you just have to add it, with the command:

conda install numpy

After I did that, the error with the import numpy was gone


The above answers seem to resolve the issue. If it doesn't, then you may also try to update conda using the following command.

conda update conda

And then try to install numpy using

conda install numpy

Move path\to\anaconda in the PATH above path\to\python


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to numpy

Unable to allocate array with shape and data type How to fix 'Object arrays cannot be loaded when allow_pickle=False' for imdb.load_data() function? Numpy, multiply array with scalar TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'" Pytorch tensor to numpy array Numpy Resize/Rescale Image what does numpy ndarray shape do? How to round a numpy array? numpy array TypeError: only integer scalar arrays can be converted to a scalar index

Examples related to anaconda

Upgrade to python 3.8 using conda Updating Anaconda fails: Environment Not Writable Error Jupyter Notebook not saving: '_xsrf' argument missing from post Conda version pip install -r requirements.txt --target ./lib How to check python anaconda version installed on Windows 10 PC? Anaconda / Python: Change Anaconda Prompt User Path How to access Anaconda command prompt in Windows 10 (64-bit) Conda activate not working? update to python 3.7 using anaconda Tensorflow import error: No module named 'tensorflow'