50

I started learning Python 3.4 and would like to start using libraries as well as Google App Engine, but the majority of Python libraries only support Python 2.7 and the same with Google App Engine.

Should I learn 2.7 instead or is there an easier way? (Is it possible to have 2 Python versions on my machine at the same time?)

Tamer Tas
  • 3,288
  • 13
  • 22
Ogre_love
  • 503
  • 1
  • 4
  • 4
  • 6
    There isn't much difference between Python 2.x+ and Python 3.x+, so you might as well learn Python 2.x+. You can have more than one version of Python on a machine at the same time, but the only way to use Python 3 with App Engine at the moment is by using the "Managed VMs" feature: https://developers.google.com/cloud/managed-vms – Michael Aaron Safyan Jun 15 '14 at 11:40
  • 3
    Google's internal issue for GAE Py3k support: https://code.google.com/p/googleappengine/issues/detail?id=909 – ygbr Sep 24 '14 at 20:16

7 Answers7

34

No, It doesn't.

[Editor's note: As of Aug, 2018, this answer is outdated; see comments and other answers]

Google App Engine (GAE) uses sandboxed Python 2.7 runtime for Python applications. That is the normal App Engine Hosting. However, in GAE you can use Managed VM Hosting.

The Managed VM Hosting lets you run GAE applications on configurable Google Compute Engine Virtual Machines. Giving you more flexibility. Managed VMs at the moment ,at Alpha phase, only support Java 7, Python 2.7 and Go 1.4 runtime environments. To get other runtimes (like Python 3 or node.js) you can create user-configurable custom runtime.

Note: With Managed VMs you won't have the capabilities of Python 2.7 GAE libraries.

  • If you insist on using GAE, since Python 3+ is not viable, I would suggest learning 2.7 and switching to 3+ versions when GAE libraries gets ported to Python 3+. You can easily switch to the other if you learn one of the versions.

  • If you insist on using Python 3+, you can use Heroku or Microsoft Azure. Both of them supports Python 2.7 and 3.4.

Richard Levasseur
  • 14,562
  • 6
  • 50
  • 63
Tamer Tas
  • 3,288
  • 13
  • 22
  • 9
    **GAE Update**: Managed VM Hosting now natively supports Python 3.4 out of the box and is in public beta (not alpha). – eestrada Feb 25 '16 at 21:03
  • 2
    Though you can't (yet) use any of the google app engine libraries with python3. https://cloud.google.com/appengine/docs/flexible/python/migrating-an-existing-app – Jonathan Apr 14 '16 at 21:59
  • 3
    Yes, it does since August 10, 2016. Check Google Cloud Platform blog https://cloudplatform.googleblog.com/2016/08/python-3-on-Google-App-Engine-flexible-environment-now-in-beta.html – JP Ventura Sep 02 '16 at 23:01
  • 5
    Standard edition supports 3.7 now: https://cloud.google.com/blog/products/gcp/introducing-app-engine-second-generation-runtimes-and-python-3-7 – gps Aug 08 '18 at 18:24
28

Since August 10, 2016, it does.

If you are using Google App Engine beta environment, you can edit your application app.yaml and specify the required Python version:

runtime: python
# vm: true has been deprecated
# check how env:flex may affect your billing
env: flex
entrypoint: gunicorn -b :$PORT main:app

runtime_config:
    python_version: 3
JP Ventura
  • 5,564
  • 6
  • 52
  • 69
  • Can you show a proper diff of the default file with your customized file? – Asclepius Nov 12 '16 at 07:58
  • As of Nov 2016, GAE does not support 3.5, just 3.4. And 3.6 is just around the corner. – Asclepius Nov 12 '16 at 08:07
  • 1
    [3.5.2 is supported (on December 2016)](https://cloud.google.com/appengine/docs/flexible/python/runtime) it is the version Ubuntu 16.04LTS manages in their repos. – Rutrus Dec 27 '16 at 13:45
  • 1
    vm:true has been deprecated and should be replaced with env:flex. Also this setting has billing repercussions that users should be aware of. – Graydyn Young Jun 30 '17 at 14:08
8

Yes. Python 3.7 is available as a Google App Engine standard runtime as of August 8, 2018.

Thomas Wouters
  • 130,178
  • 23
  • 148
  • 122
gps
  • 1,360
  • 12
  • 12
1

YES! Google App engine supports python v3, you need to set up flexible environments.

I got a chance to deploy my application on app engine and It's using python 3.6 runtime and works smoothly... :)

cutiehulk2329
  • 325
  • 5
  • 10
1

(Jun 2021): It's been more than 7 years, and many answers here are either incorrect or partially correct. At the time of this writing, Python 3 is fully-supported by all App Engine products. Here are the supported versions, links to the documentation, and launch announcements:

  1. App Engine - Standard (Aug 2018): Python 2.7 and 3.7, 3.8, 3.9
  2. App Engine - Flexible (Aug 2016 beta, Mar 2017 GA): Python 3.7(.2)

Another change since the OP is that Google Cloud launched 2 more serverless compute platforms, joining App Engine, and both support Python 3 as well:

  1. Cloud Functions (Mar 2017 beta, Aug 2018 GA): supports same versions as App Engine - Standard
  2. Cloud Run (Apr 2019 beta, Nov 2019 GA): any version you can put in a container
wescpy
  • 10,689
  • 3
  • 54
  • 53
0

Google App engine support python runtimes up to versions python v3.7 (till today).

Python v3.7 runtime fully supported by standard environment. (Non-flexible environment) and PiP packages in requirements.txt is also supported by standard runtime, will automatically install dependencies declared in requirements.txt.

app.yaml configuration for Python v3.7 follows below.

runtime: python37 
entrypoint: as you required. 

It's not required include runtime_config in app.yaml for python v3.7 standard environment.

cutiehulk2329
  • 325
  • 5
  • 10
-1

In the standard environment, vendoring was necessary to install third-party libraries. This task is not needed in the flexible environment as the runtime will automatically install dependencies declared in requirements.txt, including dependencies that require native extensions.

https://cloud.google.com/appengine/docs/flexible/python/migrating-an-existing-app#behavioral_differences

井上智文
  • 1,905
  • 17
  • 14