Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Numpy on Windows 8, in pyvenv?

I have a virtual environment set up (Pyvenv, Python 3.4), but after executing activate.bat and the command pip install numpy, i get an error stating "Unable to find vcvarsall.bat".

I added C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC to the PATH variable, which contains the vcvarsall.bat file, yet the error still remains. What is the issue here?

like image 639
Dante Avatar asked Jun 03 '14 01:06

Dante


1 Answers

You do not need to compile numpy on Windows, you can just download the binaries. The numpy team does not upload Windows binaries to pypi (an open github issue on the subject can be found here), and you will need to download them manually from an alternative site. This is quite easy:

  1. activate your env and check if you have a 32 or 64 bit Python:

    (myenv) c:\mypoject\> python -c "import platform; print(platform.architecture()[0])"
    

    This should print 32bit or 64bit.

  2. Download the correct numpy from here and save it somewhere, (i.e. c:\downloads).

    For 64bit download the win-amd-64 versions, and for 32bit use the win32 versions.

    For example, for my python 2.7, I would need to download numpy-1.10.2+mkl-cp27-none-win32.whl. Make sure you don't change the file name! .whl files needs some information from the file name to be correctly identified by the pip installer!

  3. Having your env still activated, just use pip (which supports installing from whl files) to extract and install numpy:

    (myenv) c:\mypoject\> pip install c:\downloads\numpy-1.10.2+mkl-cp27-none-win32.whl
    

That's it!

Update: edited to use pip + .whl instead of obsolete easy_install + .exe packages.

like image 155
Udi Avatar answered Sep 24 '22 02:09

Udi