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!