Windows + virtualenv + pip + NumPy (problems when installing NumPy) Windows + virtualenv + pip + NumPy (problems when installing NumPy) windows windows

Windows + virtualenv + pip + NumPy (problems when installing NumPy)


I've had success installing NumPy binaries into a virtualenv with good 'ol easy_install and a little bit of un-archiving magic.

The numpy-1.x.x-win32-superpack-python2.x.exe release you download from SourceForge is really just a thin wrapper around three separate binary distributions (with SSE3, SSE2, or no SSE enabled, depending on the capabilities of your CPU). If you open up the superpack EXE file in 7-Zip (or another archive utility), you can extract those individual setup files somewhere to use separately.

Then, activate your virtual environment, and run

easy_install c:\path\to\extracted\numpy-1.x.x-sse3.exe

to install the SSE3-optimized binaries, for example. easy_install is smart enough to find everything it needs inside that wininst bundle and will extract the compiled egg into your virtualenv's site-packages folder. I can also confirm that pip is still able to recognize and/or uninstall NumPy when you do this, and that using pip to install other packages which depend on NumPy works just fine.

The only catch is knowing which optimization level to use (SSE3, SSE2, or no-SSE). If you have a reasonably modern processor (newer than, say, a Pentium 4 or Athlon 64), it's probably safe to go with the full SSE3. You can probably also run the test suite to confirm everything works as expected.


I've found the easy_install "trick" to be really useful for installing all sorts of binary packages into a virtualenv. Even though I have all the requisite compilers set up on my machine, it's usually easier/faster/safer to stick with the official release when one is provided.


Since pip can only install from source, you need to have the setup to build and compile NumPy to be able to use pip. I never tried this.

What I did recently to get NumPy, SciPy and Matplotlib into a virtual environment on Windows 7 is to copy the directories and egg files from my regular Python install directly into the virtual environment. For Matplotlib I also managed to unzip the binary installer directly into the virtualenv (I only tried this for the Gohlke installer for Python 3.2).

I did manage in the past to easy_install NumPy into a virtualenv from a binary distribution, but I didn't manage this time (NumPy 1.5.1).

Someone recommended http://pypi.python.org/pypi/pyg which should allow to install from binary packages to a virtualenv, but I haven't tried it yet.


I didn't have to do the trick of unpacking the .exe file. I just activated my virtual environment, and then:

easy_install numpy