How to install numpy, matplotlib, pylab, scipy on Visual Studio PTVS virtual environment (virtualenv) on Azure?
I tried to run flask app in Azure that generates matplotlib pie charts and save them as PNG. I use Windows, Visual Studio 2015 and Python Tools for Visual Studio. The publish to Azure Visual Studio option requires a virtualenv to be created, then flask app is deployed with it. Adding numpy from pip appeared to be challenge because pip was trying to first compile the package, but it failed every time due to missing Visual C++ packages, wrong VS100COMNTOOLS env var path or whatever. When I fixed some previous exception, new came up. I gave up at some point and started looking for lazy way to do it.
The recommendations across the web are to use anaconda instead of PyPA (pip) package manager because it comes with the hard to compile on windows packages. However the Python Tools for Visual Studio new nothing about conda command so it tried to again download and compile through pip or easy_install.
And here is the magic:
- The precompiled pip wheels (.whl) can be found on this site http://www.lfd.uci.edu/~gohlke/pythonlibs/
- Download the binaries that you need to be installed in the virtualenv
- Create app virtual environment if you do not have one
- Open Command Prompt that would add additional packages to the virtual env
- Execute pip install path_to_your_precompiled_package.whl
The package is successfully installed in the virtualenv. Cheers!
Nice trick! I also found you could install the virtual environment as you would with virtualenv or my favorite, anaconda. Then add the virtual environment through the 'debug' tab and setting the paths to the python.exe, pythonw.exe, and the Lib folder for said environment.
On 23 Apr 2016
Yes, it is working. Great tips! Kudos to Velin =)
On 28 Jun 2016
Hi, how do I open the console with admin privileges directly? This opens with the admin privileges and hence I get an access denied error/
On 28 Sep 2016