Dante
Dante

Reputation: 11274

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?

Upvotes: 5

Views: 12308

Answers (2)

Udi
Udi

Reputation: 30522

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.

Upvotes: 8

oya163
oya163

Reputation: 1529

If you are using Python3.4 then follow these steps:

  1. Download "numpy-1.9.2+mkl-cp34-none-win_amd64.whl" file from here
  2. Copy this file to C:\Python34\Scripts
  3. In cmd.exe, run command as pip install "numpy-1.9.2+mkl-cp34-none-win_amd64.whl"

Please note:

  • cp34 -> cpython3.4

  • win -> windows

  • amd64 -> 64-bit architecture

Upvotes: 6

Related Questions