GCP deploy with 'python_version: 3.5' still uses python 3.6

325 views
Skip to first unread message

eps...@gmail.com

unread,
Aug 1, 2018, 8:59:52 AM8/1/18
to Google App Engine
GCP app has been deployed without any errors, but the runtime configurations are not being considered.

I have the following runtime settings for python in app.yaml

runtime_config:


  python_version: 3.5


But I see this error:
Traceback (most recent call last):
 
File "/env/lib/python3.6/site-packages/google/auth/transport/requests.py", line 120, in __call__
   
**kwargs)
 
File "/env/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp
= self.send(prep, **send_kwargs)
 
File "/env/lib/python3.6/site-packages/requests/sessions.py", line 622, in send
    r
= adapter.send(request, **kwargs)
 
File "/env/lib/python3.6/site-packages/requests/adapters.py", line 513, in send
   
raise ConnectionError(e, request=request)
requests
.exceptions.ConnectionError: HTTPConnectionPool(host='metadata.google.internal', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd48226c4a8>: Failed to establish a new connection: [Errno 111] Connection refused',))

sami...@google.com

unread,
Aug 2, 2018, 1:21:37 PM8/2/18
to Google App Engine

Please would it be possible to update the app.yaml file with the following information and see what is the behavior.


App.yaml

----------------------

#[START RUNTIME]

runtime: python

env: flex

entrypoint: gunicorn -b :$PORT mysite.wsgi

runtime_config:

python_version: 3

#[END RUNTIME]


Please check the following sample django documentation and cross reference the app.yaml in your environment.

https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/flexible/hello_world_django


Also, it would be really helpful it you could also check the following documentation to configure the app.yaml with version 3 for runtime configuration.

https://cloud.google.com/appengine/docs/flexible/python/runtime


Another possibility is to try and deploy the file in a different location with two versions for run-time interpreter, version 3 and 3.5, see which one is actually working for you. Thanks.


eps...@gmail.com

unread,
Aug 2, 2018, 2:01:46 PM8/2/18
to Google App Engine
If I use ..
"runtime_config:

python_version: 3"

in app.yaml file, then the runtime config uses python3.6 by default. I specifically want it to use python3.5.5 and not python3.6.


REF:
https://cloud.google.com/appengine/docs/flexible/python/reference/app-yaml
===
You can use the runtime_config section to select a specific version of Python:

runtime_config:
    python_version: <version number>
The valid values for python_version are:

3 which uses the latest supported Python 3.x release, which is currently 3.6.4.
3.4 Deprecated. This uses Python 3.4.8.
3.5 which uses Python 3.5.5.
3.6 which uses Python 3.6.4.
2 which uses Python 2.7.9.
===

Sam (Google Cloud Support)

unread,
Aug 3, 2018, 4:18:08 PM8/3/18
to Google App Engine
Your runtime settings looks fine. I suspect the issue might be in your source code because I tried to reproduce it but I was able to deploy without any errors and did not note any errors with python version in stack trace. So, I suggest you follow this Quickstart for deploying a python app in App Engine Flex environment [1]. When you've downloaded the sample code, edit the app.yaml file provided to change the 'python_version' from 3 to 3.5. Then follow the rest of the steps to test the app locally and then deploy it. This will help you identify what steps you might be missing leading to the issue you encountered. Also have a look at this documenation to understand the dependencies for your python apps [2].

Reply all
Reply to author
Forward
0 new messages