Azure WebApp Publish failed due to env not found error
See original GitHub issueSymptom
I tried to publish Flask app to Azure WebApp, but failed due to the error message below. Sadly, default Azure Flask template also failed to publish.
A virtual environment is required to deploy dependencies to Microsoft Azure Web Sites. Either add a virtual environment or add <SuppressWebSitesVirtualEnvError>true</SuppressWebSitesVirtualEnvError> to your project if you have no dependencies other than the Python standard library.
Reproduce Steps
- git pull https://github.com/azureappserviceoss/FlaskAzure.git (azure default template)
- In Visual Studio, New > Project > From Existing Python Code > select pulled folder.
- In setup wizard, set as Flask app and Detect virtual environment.
- It seems failed to detenct
env
directory. Project hasPython27 (global default)
as environment. - Right-click
Python Environment
and clickAdd Existing Virtual Environment
. - Select
env
directory and it shows “We could not find a base interpreter at D:\Python27” error. - When right-click
Python Environment
and clickAdd/Remove Python Environments
, the dialog showsenv (unavailable)
in environment list.
Questions
- Why does VisualStudio point
D:\Python27
in Step 6 and how can I fix it? I do not haveD:
drive and cannot find hard-coded line for that. - Where can I put
<SuppressWebSitesVirtualEnvError>true</SuppressWebSitesVirtualEnvError>
in web.config? I cannot find any documentation and example.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
github - unable to deploy to azure web app services
Solution: Copy the publish profile from the Azure Function App dashboard. enter image description here. Paste it in the associated GitHub ...
Read more >Azure Web App service deployments related issues
This article lists some common issues related to Azure Web App service ... Error: "No package found with specified pattern in the task"....
Read more >Troubleshoot common Azure deployment errors
There can be several reasons for this error message. 1. The deployment is attempting an operation which is not allowed on spcecified SKU....
Read more >Resource not found errors - Azure Resource Manager
Resolve errors for resource not found · In this article · Symptoms · Cause · Solution 1: Check resource properties · Solution 2:...
Read more >Getting error for azure web app published from the vs code.
I'm trying to publish the my sveltekit 1.0 application on the azure app service which runs fine locally on my machine with npm...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Virtual environments have hard coded paths to the base python path, which can cause problems if you try to reuse them across machines like you are doing here.
I would recommend that you delete it and recreate it using PTVS. Since there’s a requirements.txt at the root, PTVS will check the “install packages” in the new virtual env dialog by default.
FYI SuppressWebSitesVirtualEnvError element is meant for the .pyproj file, not the web.config file.
VS 2017 no longer requires a virtual env. Python is installed via site extension.