6

How can I install numpy in virtualenv...

easy_install numpy is throwing error.. I can not use the binary installer because this would install numpy in the python main installation and not in virtualenv..

Thanks

1

2 Answers 2

2

Another (not so great) solution is to get the installer, install it into your default Python directory, then copy it over to your virtualenv manually.

Long version

  1. Go here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
  2. Install it.
  3. Find it in your python installation (probably at C:\Python27\Lib\site_packages\numpy, or similar
  4. Copy the numpy directory over to $virtual_env\Lib\sites_packages\numpy.

Worked for me, but it's not elegant. I think there are also exe installers on numpy's site, but I find it's easier to just go to the one above when I need things than to poke around on various other sites.

Sign up to request clarification or add additional context in comments.

1 Comment

Worked. not elegent though... pip does not see the numpy install so it is not listed in the pip freeze
1

You cannot use easy_install directly for fairly technical reasons I would rather not get into. There is a solution, albeit not optimal: once in the virtual environment, go into numpy sources, and run:

python setupegg.py install

The key point is using setupegg.py instead of setup.py.

4 Comments

Hrm, doesn't work for me. Says: No module named msvccompiler in numpy.distutils; trying from distutils. error: Unable to find vcvarsall.bat
Do you have visual studio installed ?
Nope...that a dependency for numpy on Windows?
you need a C compiler, yes. Either visual studio, or mingw32 (in which case you need to call something like seutpegg build_ext -c mingw32). But really, you should just install numpy from binaries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.