Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Subsequent releases in the Python 3.x series have included additional, substantial new features; all ongoing development of the language is done in the 3.x series.

Porting your code to

...

Python 3

Info

For a complete reference and advise, see https://docs.python.org/3/howto/pyporting.html

It is possible to write code that works for both major versions of Python, and it is the recommended strategy for maximum compatibility and flexibility. See the following page for a comprehensive list of compatible idioms. The easiest way to make sure your python 2 code can run on python 3 is to use automatic conversion tools such as futurize. Even if they are not perfect in all cases, they should take care of adapting the vast majority of your code base without too many bugs introduced. Futurize will also generate code that is compatible with both editions. See the quick start guide for instructions on how to use this tool.

...

Info

Both python and python3 modules can be loaded at the same time.

Python3 module IS NOT loaded by default, so do not forget to load it before running your scripts!

Newest versions of the ECMWF packages and libraries support now both python 2 and 3. At ECMWF, their installations are done so both python 2.7 and 3.6 can be used. In order to work with the new python 3, you should:

...

For sustainability and maintainability reasons, some extra modules available in python Python 2 may not be installed in python3the Python 3. If you need a module that is missing, please consider if you can use it through a virtual environment. This is particularly recommended if the module is being evaluated or tested, or if it's not going to be used widely at the centre. If in doubt, please get in touch with servicedesk@ecmwf.int.