r/Python • • Jun 08 '15

Installing Numpy is not working

I have 64-bit windows, python 3.4, and I need to install numpy. I've downloaded it from multiple sources, and followed multiple sets of instructions. But anything I do in the command prompt throws an error, either from pip for from the file location where numpy is.

Could somebody walk me through, step by step by step, what to do to install numpy? It would be greatly appreciated.

0 Upvotes

15 comments sorted by

View all comments

1

u/Zifendale Jun 08 '15

I had the same problem (with python 3.3) and had to solve it... twice. So the second time around I made a batch script with the steps I took. This script also sets it up in a virtualenv so you will need to adjust it for your needs. The prerequisites may have some overlap as well...

I sometimes used easy_install for easy to get windows binaries, keep an eye out for those requirements.

Again, you will need to adjust this script for your needs...

Here is the script!

REM Prerequisites:
REM git http://git-scm.com/
REM Visual C++ 2010 Express (For Python 3.0+) https://app.vssps.visualstudio.com/profile/review?download=true&family=VisualStudioCExpress&release=VisualStudio2010&type=web&slcid=0x409&context=eyJwZSI6MSwicGMiOjEsImljIjoxLCJhbyI6MCwiYW0iOjAsIm9wIjpudWxsLCJhZCI6MSwiZmEiOjAsImF1IjpudWxsLCJjdiI6MjEyMTY5MzIyMSwiZnMiOjAsInN1IjowLCJlciI6MX01
REM Windows SDK for Win7 and .NET Framework 4 https://www.microsoft.com/en-us/download/details.aspx?id=8442
REM Windows Compiler SP1 Patch http://www.microsoft.com/en-us/download/details.aspx?id=4422
REM Fortran Compiler g77 provided via Windows Binary from MinGW http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download
REM Add C:\MinGW\bin to Environment Variables

REM Create virtualenv

@echo off
SET virtenvdir="C:\VIRTUALENV FOLDER LOCATION"
SET scriptdir="C:\VIRTUALENV FOLDER LOCATION\Scripts"
SET repodir="C:\VIRTUALENV FOLDER LOCATION\Repos"

SET sdkdir="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin"
cd %sdkdir%
SET DISTUTILS_USE_SDK=1
call setenv /x64 /release

cd %virtenvdir%
echo Activating virtualenv
call .\Scripts\activate.bat

echo Installing dependencies
cd %scriptdir%
REM Cython is a required as C compiler dependency for Numpy and Pandas
call easy_install.exe "%virtenvdir%%\Prereqs\pyodbc-3.0.7.win-amd64-py3.3.exe"
REM Rpy2 dependencies
call pip3.3.exe install wheel
call pip3.3.exe install "%virtenvdir%%\Prereqs\rpy2-2.5.6-cp33-none-win_amd64.whl"
call easy_install.exe "%virtenvdir%%\Prereqs\pywin32-219.win-amd64-py3.3.exe"
call pip3.3.exe install singledispatch

call pip3.3.exe install -U Cython
call pip3.3.exe install -U SQLAlchemy

echo Pulling required repositories
cd %repodir%
REM clone repos from github
call git clone https://github.com/numpy/numpy.git
REM call git clone https://github.com/scipy/scipy.git
REM call git clone https://github.com/ipython/ipython.git
call git clone https://github.com/pydata/pandas.git

REM Compile each repo and install under current virtualenv
echo Compiling repositories
cd "%repodir%\numpy"
call python setup.py build
call python setup.py install

REM cd "%repodir%\scipy"
REM call git clean -xdf
REM call python setup.py install

REM cd "%repodir%\ipython"
REM call python setupegg.py install

REM cd "%repodir%\pandas"
call python setup.py build_ext --inplace
call python setup.py install

echo Deactivating virtualenv
cd %virtenvdir%
call .\Scripts\deactivate.bat