G33K-TRICKS: How to Install Numpy python module on Windows [SOLVED]

Wednesday, February 3, 2016

How to Install Numpy python module on Windows [SOLVED]


Simple, tried and tested steps to install Numpy module


Pre-requisite, would be "You are already having Python installed on your system"
Next Download the Numpy module from https://pypi.python.org/pypi/numpy
 [I downloaded the Zipped one, so can you  ;) ]

Unzip the downloaded Numpy and go to
C:\Users\<USERNAME>\Downloads\numpy-1.10.4\numpy-1.10.4
using command prompt. This is where setup.py is available.

Now type commands,
python setup.py build

If building does not throw any errors , run
python setup.py install

In-case you see some error similar to error: Unable to find vcvarsall.bat
Which implies you dont have Microsoft Visual studio to build the module.

Either you can download one or there is another way of doing it.
Download, MinGW (32/64) from http://sourceforge.net/projects/mingw/files/

Select ‘download latest repository catalogues’.
Next you select a folder (i.e. C:\MinGW) and the programming support you require: C and C++  (I kept Fortran and ObjC as deselected).
You need "MinGW Developer Toolkit" installed.
If you select this option you’ll get MSYS as well.
H
Next thing you need to do is to configure your PATH environment variable.

Right-click on My Computer and Select Properties
Go to the tab ‘Advanced’ and select ‘Environment variables’
Select ‘Path’ from the ‘System Variables’ and click the ‘Edit button’
Add the following paths to your variables: ‘C:\MinGW\bin;'  (without quotes)

Now, Edit / Create new file  "distutils.cfg" at C:\Python26\Lib\distutils\distutils.cfg with following change

[build]
compiler=mingw32

Remember, in case you created new file distutils.cfg , the file type should be CFG not TXT
To avoid this, while saving select "Save As" option and then in the "Save as Type" drop down select
"All Files" . Then in the "Filename" field type distutils.cfg and then save.

Open new command prompt and again go to  C:\Users\<USERNAME>\Downloads\numpy-1.10.4\numpy-1.10.4
Run, 
python setup.py build

And if no issues seen,
Run,
python setup.py install



And its Done!!!


1 comment: