dev_appserver.py says Unknown runtime 'python38'

507 views
Skip to first unread message

Boro

unread,
Jan 13, 2021, 11:32:16 AM1/13/21
to Google App Engine
I'm trying to upgrade the GAE runtime on several python projects from python37 to python38.
I've used dev_appserver.py to test the apps locally before we deploy but I'm getting an unknown runtime error after changing the runtime to python38. Python 3.8 should be a supported runtime according to the appengine docs.

I've also updated all gcloud cli components to the latest version. Is this just something that's been changed/deprecated and I'm just not aware of it? or is it actually a bug and missing from the `dev_appserver.py` tool?

Any help would be appreciated! :)


```
RuntimeError: Unknown runtime 'python38'; supported runtimes are 'custom', 'go', 'go111', 'java', 'java7', 'java8', 'php55', 'php72', 'python', 'python-compat', 
'python27', 'python37'.
```


Full traceback:

```
Traceback (most recent call last):
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 96, in <module>
    _run_file(__file__, globals())
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 90, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 613, in <module>
    main()
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 601, in main
    dev_server.start(options)
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 373, in start
    options.api_host, apiserver.port, wsgi_request_info_)
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 259, in start
    ssl_port)
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 396, in _create_module
    ssl_port=ssl_port)
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1313, 
in __init__
    super(AutoScalingModule, self).__init__(**kwargs)
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 599, in __init__
    self._module_configuration)
  File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 226, in _create_instance_factory
    sorted(repr(k) for k in runtime_factories.FACTORIES))))
RuntimeError: Unknown runtime 'python38'; supported runtimes are 'custom', 'go', 'go111', 'java', 'java7', 'java8', 'php55', 'php72', 'python', 'python-compat', 
'python27', 'python37'.
```

Elliott (Cloud Platform Support)

unread,
Jan 13, 2021, 1:49:41 PM1/13/21
to Google App Engine

Hello,

I understand that you want to use the dev_appserver to test your application but you receive an error that version 3.8 of python is not found.

I have found a thread in Stackoverflow with the same question and you proposed information here.

I believe that Stackoverflow is the correct forum that you chose and all future interactions will be done in that thread.

But for best practices since Google Groups is meant for general discussions, I would suggest from this document:

To test your application's functionality before deploying, run your application in your local environment with the development tools that you usually use. We recommend that you use standard Python tools, such as virtualenv to create isolated environments and pytest to run unit tests and integration tests, rather than depending on dev_appserver, the local development server provided with the Google Cloud SDK.

Boro

unread,
Jan 13, 2021, 1:56:41 PM1/13/21
to Google App Engine
TL;DR:  the dev_appserver.py tool's list of supported runtimes needs to be updated to include the python38 runtime

My hacky workaround/solution:
I found and edited the runtime_factories.py file located in the gcloud devappserver2 tool directory. On my Ubuntu 18.04 install, it was located here: 
```
/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/runtime_factories.py
```

I added `python38` to both `MODERN_RUNTIMES` and `FACTORIES` like this:
```
MODERN_RUNTIMES = set(['python38', 'python37', 'go111'])


FACTORIES = {
    'go': go_factory.GoRuntimeInstanceFactory,
    'go111': go_factory.GoRuntimeInstanceFactory,
    'php55': php_factory.PHPRuntimeInstanceFactory,
    'php72': php_factory.PHPRuntimeInstanceFactory,
    'python': python_factory.PythonRuntimeInstanceFactory,
    'python38': python_factory.PythonRuntimeInstanceFactory,
    'python37': python_factory.PythonRuntimeInstanceFactory,
    'python27': python_factory.PythonRuntimeInstanceFactory,
    'python-compat': python_factory.PythonRuntimeInstanceFactory,
    'custom': custom_factory.CustomRuntimeInstanceFactory,
}
```

Then hit save, and ran dev_appserver.py again and IT WORKED! I've also confirmed that it's actually running python38 runtime! 

@Google, please update the tool so others don't have to do this hacky workaround! 🙏

Thank you!

On Wednesday, January 13, 2021 at 11:32:16 AM UTC-5 Boro wrote:

Rishi Sharma

unread,
Jan 14, 2021, 10:02:49 AM1/14/21
to google-a...@googlegroups.com
You can try updating to the latest Cloud SDK.  It should be included in that version.  I * believe * there is a new version available as of yesterday.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/0ff40104-d0a3-4677-9bb3-21bd3c62f917n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages