Anaconda Installation on Azure Web App Services - python

I install my python modules via pip for my Azure Web Apps. But some of python libraries that I need are only available in conda. I have been trying to install anaconda on Azure Web Apps (windows/linux), no success so far. Any suggestions/examples on how to use conda env on azure web apps?

Currently, Azure App Service only supports the official Python to be installed as extensions. Instead of using the normal App Service, I would suggest you to use a Webapp for Container so that you can deploy your web app as a docker container. I suppose this is the only solution until Microsoft supports Anaconda on App Service.

Related

How can I install my own Python package in Azure Web App Service Linux environment?

I deployed my Python Django project to Azure Web Service Linux environment, and found an error most likely caused by the version of Azure's own Python version (see this post Azure Text to Speech Error: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) when deploying to Azure App Services Linux environment ). However, I cannot seem to find a way to upload my own Python package (3.10) to Azure Web Service Kudu site. Is there a way to do it?
Thanks.
Currently, This is not possible, the latest python runtime available in the Linux web app is 3.9
and in the other question, The default Linux Kudu page has a minimum number of features available when compared to windows and so you cannot directly drag and drop your zip file. If you need to install more components or language runtimes, you just need to use Kudu SSH terminal using apt-get install <packages>.
Also, try checking Configure a Linux Python app for Azure App Service
Python 3.10 is now supported on App Service, so for this particular problem, you can update the configuration to Python 3.10.

Is it possible to deploy Python Azure Function on Windows OS Image

I have successfully installed a Python Function on a Linux VM, but due to some dependencies I need it to be deployed on Windows. It is set to be deployed on Linux, but is it possible to deploy it on Windows VM?
At this time no, Python Functions are only supported in App Service Plans using Linux.
Your Azure Function App has 'FUNCTIONS_WORKER_RUNTIME' set to 'dotnet'
while your local project is set to 'python'. You can pass --force to
update your Azure app with 'python' as a 'FUNCTIONS_WORKER_RUNTIME'
C:\Users\-----\source\repos\func\MyFunctionProj>func azure functionapp publish pyfunc1 --force
Setting 'FUNCTIONS_WORKER_RUNTIME' to 'python' because --force was
passed Getting site publishing info... Publishing Python functions is
only supported for Linux FunctionApps

How do you pip install libraries to the 'antenv' venv on an Azure Web App?

I am trying to deploy a Flask app to an Azure Web App (Linux, python3.7 runtime) using FTP.
I copied the "application.py" over and a "requirements.txt", but I can see in the logs that nothing is being installed.
The Web App is using an 'antenv' virtual environment but it won't install anything. How do I add libraries to this 'antenv' virtual environment?
Yes, I see that you have resolved the issue. You must use Git to deploy Python apps to App Service on Linux so that your dependencies in requirements.txt are installed (root folder).
To install Django and any other dependencies, you must provide a requirements.txt file and deploy to App Service using Git.
The antenv folder is where App Service creates a virtual environment with your dependencies. If you expand this node, you can verify that the packages you named in requirements.txt are installed in antenv/lib/python3.7/site-packages. Refer this document for more details.
Additionally, Although the container can run Django and Flask apps automatically, provided the app matches an expected structure, you can also provide a custom startup command file through which you have full control over the Gunicorn command line. A custom startup command is typically required for Flask apps, but not Django apps.
Turns out I had to run these commands and do a git push while my local venv was activated. At that point I saw azure start downloading all the libraries in my requirements.txt

Extensions not supported on Azure App Service Environment

We've recently moved from App Service to App Service Environment on Azure. We need Python 3.6 to run the web API. But we're not able to install the extensions. Are extensions disabled on App service environment. Azure by default offers Python 3.4.1. But few of the libraries need a minimum of 3.6.4 which is available as a extensions. Is there a workaround for this or are we limited to the default Python 3.4.1 available with Azure ?
In case you haven't seen already, see article
https://blogs.msdn.microsoft.com/pythonengineering/2016/08/04/upgrading-python-on-azure-app-service/
Microsoft says you can run newer versions, 3.4 is default purely to prevent breaking compatibility with existing sites.
Azure menu layout sometimes (annoyingly) changes from guides, but I was able to find it searching "Extensions" in the Menu for my App Service
This is indeed possible but took a bit of experimenting. I had to open the Kudu console from a VM which is inside the same VNet as the App Service Environment. From there on, it's a cake walk. You can also configure Web Jobs from the VM which is otherwise not possible from the portal.

How to deploy django web application on Microsoft Azure cloud services

I have a existing django web application currently deployed on aws. I want to deploy it on Microsoft Azure by using cloud services. How to create config files for deploying web app on Azure? How to access environment variables on Azure? I am not using Visual Studio. I am developing web app in linux env and using git for code management. Please help
It sounds like you want to know which way is the best choice for deploying a django app via Git for code management on Linux, using Cloud Services or App Services on Azure.
Per my experience, I think deploying a pure web app into App Service on Azure via Git on Linux is the simplest way for you. You can refer to the offical docuemnts below to know how to do it via Azure CLI or only Git.
Deploy your first Python web app to Azure in five minutes
Local Git Deployment to Azure App Service
And there is a code sample of Django on App Service as reference that you can know how to configure it for running on Azure.
However, if your app need more powerful features & performance, using Cloud Services for your django app is also a better way than using VM directly. Also as references, please view the document Python web and worker roles with Python Tools for Visual Studio to know how to let Azure support Python & Django on Cloud Services, and you can create & deploy it via Azure portal in the browser on Linux. Meanwhile, thanks for the third party GitHub sample of Django WebRole for Cloud Service which you can refer to know how to create a cloud service project structure without PTVS for VS on Linux.
Hope it helps.
I read this post, decided the how-to guides Peter Pan posted looked good, and set off on my own. With my one business day's worth of experience if you are looking to deploy your app to Azure, start with the Marketplace Django app and go from there. Reason being the virtual environment comes with it along with the activate script needed to run the virtual environment and the web.config is setup for you. If you follow the start from scratch how-to guides, these are the hardest parts to setup correctly. Once you create the app service from the template, do a git clone of the repo to your local machine. Make a small change and push it back up by running the command below in bash.
az webapp deployment source config-local-git --name <app name> --resource-group <group name> --query url --output tsv
Use the result of the command to add the git repo as a remote source.
git remote add azure https://<ftp_credential>#<app_name>.scm.azurewebsites.net/<app_name>.git
Finally, commit your changes and deploy
git add -A
git commit -m "Test change"
git push azure remote
A couple of side notes
If you do not have your bash environment setup, you'll need to do so to use the az commands. The marketplace app does run error-free locally. I have not dug into this yet.
Good luck!

Categories