question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure WebApp Publish failed due to env not found error

See original GitHub issue

Symptom

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

  1. git pull https://github.com/azureappserviceoss/FlaskAzure.git (azure default template)
  2. In Visual Studio, New > Project > From Existing Python Code > select pulled folder.
  3. In setup wizard, set as Flask app and Detect virtual environment.
  4. It seems failed to detenct env directory. Project has Python27 (global default) as environment.
  5. Right-click Python Environment and click Add Existing Virtual Environment.
  6. Select env directory and it shows “We could not find a base interpreter at D:\Python27” error.
  7. When right-click Python Environment and click Add/Remove Python Environments, the dialog shows env (unavailable) in environment list.

Questions

  1. Why does VisualStudio point D:\Python27 in Step 6 and how can I fix it? I do not have D: drive and cannot find hard-coded line for that.
  2. Where can I put <SuppressWebSitesVirtualEnvError>true</SuppressWebSitesVirtualEnvError> in web.config? I cannot find any documentation and example.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
huguesvcommented, Oct 31, 2016

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.

0reactions
huguesvcommented, Oct 11, 2018

VS 2017 no longer requires a virtual env. Python is installed via site extension.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found