Extensions not supported on Azure App Service Environment - python

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.

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.

Azure python SDK run powershell script inside a Virtual Machine

Summary: I'm trying to create a python program to run Powershell scripts in Azure Windows VMs. But I can't find good documentation about which libraries of the SDK I can use.
Detailed: In order to automate certain administrative tasks, a python program should run, authenticate into Azure and then run Powershell scripts in certain Windows VMs. I think I have the auth part thanks to azure.identity, but I can't find any library to interact with a running VM. Sure, lots for creating or modifying a VM in Azure, but nothing to interact with it. Neither in the SDK or in the API browser. I know it can be done with Azure CLI, but id like to use the SDK, if possible at all.
My understanding is that you would like to run PowerShell remotely using the Python SDK.
AFAIK, I don't think there is a provision within the Azure Python SDK to run remote PS scripts.
Workaround :
(But please note that this outside the Azure Python SDK.)
You could create Azure Windows WinRM VM template and you could execute ps commands from the Python code using the winrm library like discussed in this thread.

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 I connect to an external Oracle database using the Python cx_Oracle package on Google App Engine Flex?

My Python App Engine Flex application needs to connect to an external Oracle database. Currently I'm using the cx_Oracle Python package which requires me to install the Oracle Instant Client.
I have successfully run this locally (on macOS) by following the Instant Client installation steps. The steps required me to do the following:
Make a directory called /opt/oracle
Create a symlink from /opt/oracle/instantclient_12_2/libclntsh.dylib.12.1 to ~/lib/
However, I am confused about how to do the same thing in App Engine Flex (instructions). Specifically, here's what I'm confused about:
The instructions say I should run sudo yum install libaio to install the libaio package. How do I do this on GAE Flex? Or is this package already available?
I think I can add the Instant Client files to GAE (a whopping ~100MB!), then set the LD_LIBRARY_PATH environment variable in app.yaml to export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH. Will this work?
Is this even feasible without using custom Docker containers on App Engine Flex?
Overall I'm not sure if I'm on the right track. Would love to hear from someone who has managed this before :)
If any of your dependencies is not available in the base GAE flex images provided by Google and cannot be installed via pip (because it's not a python package or it's not available in PyPI or whatever other reason) then you can't use the requirements.txt file to get it installed in your GAE flex app.
The proper way to satisfy such dependencies would be to build your own custom runtime. From About Custom Runtimes:
Custom runtimes allow you to define new runtime environments, which
might include additional components like language interpreters or
application servers.
Yes, that means providing a custom Docker file. In your particular case you'd be installing the Instant Client and libaio inside this Dockerfile. See also Building Custom Runtimes.
Answering your first question, I think that the instructions in the oracle website just show that you have to install said library for your application to work.
In the case of App engine flex, they way to ensure that the libraries are present in the deployment is with the requirements.txt textfile. There is a documentation page which does explain how to do so.
On the other hand, I will assume that "Instant Client Files" are not libraries, but necessary data for your App to run. You should use Google Cloud Storage to serve them, or any other alternative of Storage within Google Cloud.
I believe that, if this is all what you need for your App to work, pushing your own custom container should not be necessary.

App Engine is not supported for python 3 in pycharm

I want to create a google app engine project in pycharm. I select python 3, give my project a name.
And it's written that App Engine is not supported for the selected interpreter
I can choose python 2.7 and it is working but why can't I choose python 3.6? I even tried 3.5, same problem. However in official documentation it supports python 3.6...
I'm sure I have installed google app flexible environment
I'll leave there a screen of pycharm just in case gdrive link
AFAIK PyCharm's GAE support means:
ability to run/debug a GAE app project using the SDK's dev_appserver.py - which is only supported for the standard environment
ability to deploy on GAE using the SDK utilities - which not long ago didn't even support well apps with multiple standard environment services - I had to deploy my app manually.
In other words PyCharm doesn't offer real/significant benefits for the flexible env GAE apps, you'll have to complement it with manual ops or scripts anyways.
So I'd just create a regular python 3.5/3.6 project and simply not specify it's also a GAE project.

Categories