Install NumPy in a Virtual Environment on Windows

Someone told me they use a custom python install named Anaconda on windows because it contains a set of math packages which are difficult to install. In fairness, they’re right because any python module with native dependencies is a mess to install from sources (e.g. because you need the same version of Visual Studio used to build the python install).

When I tried to tell them the benefits of using virtual environments (which are created clean by default), I’ve been asked to try and install numpy in a virtual environment.



First, let’s assume the following:

  • The OS is Windows (Win7 in my case, but the differences should be minor);
  • You have installed Python 2.7 and setuptools, pip and virtualenv successfully;
  • Create a virtual environment (e.g. creating a virtual environment in “C:\Proagam Files (x86)\Python\virtualenvs” named “numeric” would create a new directory with the relevant stuff “C:\Proagam Files (x86)\Python\virtualenvs\numeric”)
  • Activate the virtual environment
  • Set any proxy if needed

Installing NumPy

Once you have performed all of the above, there are two ways to install numpy:

  1. If you have development tools
  2. If you don’t :)

NumPy from Source Code

If you have all relevant developer tools like Visual Studio (C++) and Intel’s libraries, then all you need to do is install numpy from source code:

Numpy from Binaries

If you prefer not to get your hands dirty with compiling stuff, then you can install from a pre-compiled distribution. The steps I used are enumerated below:

  • Go to;
  • Download the relevant library. Don’t install it just yet;
  • Open the binary (setup file) with 7zip. It has 2 directories: PATLIB and SCRIPTS;
  • Copy the contents of “PLATLIB” (the numpy directory and the numpy-1.x.x-py…info into your virtualenv’s \Lib\site-packages directory (e.g. “C:\Program Files (x86)\Python\virtualenvs\numeric\Lib\site-packages”);
  • Copy the contents of “SCRIPTS” into your virtualenv’s \Scripts directory (e.g. “C:\Program Files (x86)\Python\virtualenvs\numeric\Scripts”);
  • Test the installed numpy with something like:

It’s more manual but that’s because the setup executable doesn’t allow you to set up a custom path (for example the binary install of CX_oracle allows you to do that and you can just run the installer).


A little experiment: If you find this post and ad below useful, please check the ad out :-)

8 thoughts on “Install NumPy in a Virtual Environment on Windows

    1. Pakai cara yang mana? saya juga pakai Visual Studio 2013. Trims

      Disposable way where? I also use Visual Studio 2013. Trims (via Google translate)

  1. Thanks! Although it strictly didn’t work, it set me on the right path. I found it easier to place the .whl inside of the env forlder, then pip install using “pip install –no-index –find-links=C:\Users\Me\Downloads numpy-1.9.2+mkl-cp34-none-win32.whl” on Visual Studio 2013. It looks like it fails to find it during the first attempt, then resorts to downloading the same file name in the env. All is well now!

      1. No problem.. and let it be known that it can be as simple as just placing the .whl in the env folder then just “pip install –no-index wheel_file_name.whl” (the first entry.. and maybe this one too, made it look like the first two dashes was just one dash)
        Thanks again, you set me on the right track!

  2. Thank you Laur for your extremely useful post. It worked! You’re so smart. I am impressed and bookmarked your site. Thank you very much. Your help is greatly appreciated indeed.

    All the very best always


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top