I'm considering using an Azure web site for a Python project with Flask. I already have a test site running with this configuration. I'm using cPhyton 2.7; IronPhyton is absolutely discarded for this project and, as far as I know, it is not (yet) supported in Azure.
The bad part is that I need to add scipy
& numpy
to this project, this is an unavoidable requirement. As far as I know, numpy and scipy are a mix of compiled unmanaged code and python code and they're not part of the standard Azure infrastructure.
Is it possible to add numpy/scipy packages to an Azure web site? If it is, how?
Note: I know I could use a virtual machine for this (azure or not), that's my second option, but I would like to make an informed decision.
Thank you
NumPy can be used to perform a wide variety of mathematical operations on arrays. It adds powerful data structures to Python that guarantee efficient calculations with arrays and matrices and it supplies an enormous library of high-level mathematical functions that operate on these arrays and matrices.
Before you can import numpy, you first need to install it. There are two ways to install numpy: Install the binary (pre-compiled) version using pip. Compile it from source code, and then install it.
Numpy is memory efficient. Pandas has a better performance when a number of rows is 500K or more. Numpy has a better performance when number of rows is 50K or less. Indexing of the pandas series is very slow as compared to numpy arrays.
I was able to add Numpy to my Azure Web App site. I believe my method also works for SciPy.
I am assuming you have a local repository (I am using GIT) and upload it to your Azure site. I am using Django and there is a file called requirements.txt in the base, which I bet is there for Flask also. Each line of this file contains a package that you want added to the installation.
At first I simply added a line with "Numpy" to it and Azure found a package and tried to install but this failed. So my next attempt I downloaded a "wheel" .whl package from this site:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
which includes all dependencies. Download the appropriate file (correct version of Python and 32 or 64 bit which can be chosen on Azure control panel) of the Numpy and SciPy wheel files and stick them into your base directory and add them to your project. Now a line to requirements.txt with just the file name, like this:
numpy-1.9.2+mkl-cp27-none-win32.whl
Commit and push to Azure and Voila! everything installs correctly. This also worked for me for the OpenCV wheel package at that site. Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With