ValueError: virtualenv: cannot access lib: No such virtualenv or site

531 views
Skip to first unread message

Craig Dsouza

unread,
Jun 26, 2018, 2:32:19 PM6/26/18
to Google App Engine
Hi there,
I'm new to GCP so I've had very limited success trying to debug this. 

I have a flask app which I developed using a similar process to the one described in the docs here
It runs well on my local machine, tested it out with dev_appserver.py 

Tried deploying it to App Engine using the Cloud SDK and the deployment is successful but the app itself shows this message

Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.


When I check out 'Error Reporting' in the console I see the following message

 ValueError: virtualenv: cannot access /base/data/home/apps/j~project-name/20180626t222233.410714851322767617/lib: No such virtualenv or site 

I looked into StackOverflow and it appears the error is coming from this file, google.appengine.ext.vendor

Source code here: 

https://cloud.google.com/appengine/docs/standard/python/refdocs/modules/google/appengine/ext/vendor

but I'm clueless regarding how to troubleshoot this.

tried the suggestions given here, 
changed the appengine_config.py file and redeployed, but I'm still getting the same error 

any tips on how to debug this, i'm not even sure which 'lib' folder the error is referring to

Craig Dsouza

unread,
Jun 26, 2018, 4:43:44 PM6/26/18
to Google App Engine
After a little more reading I'm wondering whether its my project file structure that is the issue

it is something like
-- project folder
    -- venv (python virtual environment)
       -- Include
       -- Lib
       -- Scripts
       -- tcl
       -- static (html,css,js)
       -- templates (jinja templates)
       app.yaml
       appengine_config.py
       main.py
       requirements.txt

does this seem right?

Best
Craig


George (Cloud Platform Support)

unread,
Jun 28, 2018, 12:40:19 PM6/28/18
to Google App Engine
In fact, the project structure indicated on the "Getting Started with Flask on App Engine Standard Environment" page is: 

flask-app project structure

app.yaml: Configure the settings of your App Engine application
main.py: Write the content of your application
static: Directory to store your static files
style.css: Basic stylesheet that formats the look and feel of your template files
templates: Directory for all of your HTML templates
form.html: HTML template to display your form
submitted_form.html: HTML template to display the content of a submitted form

How does your app.yaml look like? In particular, what stays written under the "handlers" entry? It may be worthwhile having a look at "Creating a request handler for your Flask app" sub-chapter
Reply all
Reply to author
Forward
0 new messages