I am trying to run a python flask app on azure app service for linux and I am deploying it using git hub actions, but I am running in to ModuleNotFoundError: No module named 'html2text' Error. Below are app service logs :
I am new to app service and flask applications and dont understand what is the reason as the build of the application is fine and all dependencies from requirement.txt are installed.
Here are the logs of my build showing the package getting installed :
I need support here guys ! Thanks.
I have deployed Python Flask app in Azure using GitHub Actions.
Please Check the below Work around
Make sure you are using the latest Python version
No module named 'html2text'
Create a python flask app in Local environment and push it to Git new repository.
In Azure Portal => Deployment Center => Settings => Select GitHub as Source and provide the required details and Save.
Workflow in GitHubAction :
Verify,html2text must be installed in dist-packages folder.
Issue will be resolved with the latest python version. If you are still getting the same error, Install the html2text.
In VSCode, Terminal run the below command to install html2text
pip install html2text
Related
i am trying to install jdk on python webapp so that I can use Sparksession in my python code. But jdk gets installed in /usr/lib directory instead of /home directory and anything outside /home directory does not persist. That is why even if I use Java tool installer and try to install jdk through command line in azure pipeline, still i get JAVA_HOME not set error.
You can't modify any OS level as App Service exists in a sandbox; see https://learn.microsoft.com/en-us/azure/app-service/operating-system-functionality. Every app service comes preconfigured with various SDKs. If your app is hosted in a Windows app service, you can run echo %JAVA_HOME% from the CMD/Powershell to see what the version is.
If the available version is lower than what you need, I suggest switching to Web App for Containers where you can install the JDK you need on your image.
I am following this tutorial on how to create a HTML web app within Azure
When I enter the az webapp up command I receive the error:
Could not auto-detect the runtime stack of your app, see 'https://go.microsoft.com/fwlink/?linkid=2109470' for more information
The version of Azure CLI I'm running is:
azure-cli 2.0.78 *
command-modules-nspkg 2.0.3
core 2.0.78 *
nspkg 3.0.4
telemetry 1.0.4
Extensions:
azure-devops 0.16.0
Any help with this would be much appriciated!
I ran into the same problem and it looks like there is a problem with static html site. Today version 2.0.79 was released and it supports an --html flag. At least my app is now working.
The tutorial guide you use the Azure Cloud Shell to deploy it, but as you know the CLI in the Cloud Shell is version 2.0.78 and it does not support the parameter --html and you also cannot upgrade the CLI in the Cloud Shell.
The parameter now is only supported in version 2.0.79. So the solution is to install the CLI in your own environment. Follow the steps here to install the CLI then it will work well with the parameter --html.
It just seems the issue is with the current directory from which the command is run.
It probably needs to detect files specific to a run-time stack before uploading the app; Such files, like the 'package.json' file for Node.js would on exist within the app's directory. So please try 'cd' into the app's directory
i have just begun with Azure.
Here i have simple flask api and i tried to deploy the app with azure cli in vscode then it ends up with following error. I'm completely new to Azure so can anyone please sort out this for me. Thanks in advance.
I cannot reproduce your issue, but here is what I did and it can publish successfully using python 3.7. Note: I'm using azure cli version 2.0.75. Please check your cli version using az --version, and upgrade it as per this link if you're using old version.
1.Create a web app for Linux, the screenshot as below:
2.After step 1 is completed, then in visual studio code, open the folder where your project locates, and follow this doc:
In visual studio code -> terminal, use the following commands first(you need to nav to the folder where the project locates):
py -3 -m venv env
env\scripts\activate
pip install -r requirements.txt
Set-Item Env:FLASK_APP ".\application.py"
flask run
Then, input the commands to publish the flask api:
az webapp up --sku F1 -n <app-name> -l <location-name>
it can be published successfully. The screenshot as below:
i am using Azure DevOps Build & Release to build my node.js react app that uses node-sass. So the Build is using the Node.js Tool Installer to specify the node.js version and then runs the npm install command. It all runs with a hosted agent that requires node.js and npm. The azure app service which runs the application is a default windows site.
After that i want to deploy it via Azure DevOps Release. I am using the Task "App Service Deploy" to deploy it. If i don't specify a deployment method it uses "Run from Package" and everything is fine. (Except that i cannot make changes in the root folder, but thats the concept of the run from package). If i change it to deploy via "Zip Deploy" i get the following error:
Error: Missing binding
D:\local\Temp\zipdeploy\extracted\node_modules\node-sass\vendor\win32-ia32-57\binding.node
Node Sass could not find a binding for your current environment:
Windows 32-bit with Node.js 8.x Found bindings for the following
environments: Windows 64-bit with Node.js 8.x
So i got this one already in my dev environment, but there i could get a simple workaround - install and use the 32bit version of node.js and then deploy it to azure (via VS Code extension). Now it is not possible to use 32bit nodejs in the Azure DevOps Build task as i saw as a limitation of the windows app services in azure.
How can i get Azure DevOps to use 32 bit when using npm install? Is the only possible way to switch to a linux app service (which runs 64bit) in azure?
Thanks!
I created an App Service on Linux in Azure portal, hoping to use if as a managed Node.js server. A simple test app works but when coming to install bip32, or other web3 related packages I get the following error:
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
The obvious next step is to install Python, but the machine doesn't have any of the usual tools used for installing. No apt-get. No yum.
Any other options I could use for installing packages?
For your issue, you could have something misunderstand. The Azure Web App Service just allow you to manage your application, do not allow you to change the running environment in the Service Plan. For example, like that, you want to install tools such as apt and npm in it.
Azure provides some built-in runtime to Web App. Just like Node.js x, Python x, etc. You can choose an appropriate one to use. Even if there is no one suitable for you, you can make your application into a Docker image and create the Web App from it. Of curse, you should make sure your application can work well in the image and you can install the tools which you need. For more details, see Use a custom Docker image for Web App for Containers. Hope this will be helpful to you.