[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ESPResSo-users] Dropping Python 2 support

From: Rudolf Weeber
Subject: [ESPResSo-users] Dropping Python 2 support
Date: Thu, 25 Jul 2019 12:07:21 +0200
User-agent: Mutt/1.9.4 (2018-02-28)


As you may now, Python 2 will not be supported past the end of the year.
Also, major Linux distributions will no longer ship it by default in their 
upcoming releases.
Python 3 was released in 2008. Espresso 4.0 can be used with both, Python 2 and 
Python 3. However, as most other Python-based projects, we are dropping support 
for Python 2 for our next release (4.1) and in the development branch.

# Making sure, you are Python 3 ready

## Presence of dependencies to build Espresso

Current Linux distros such as Ubuntu 18.04 LTS already support Python 3. All of 
Espresso's dependencies can be installed from the Distros package manager, 
e.g., python3-numpy.
We have updated the installation instructions for Ubuntu and Mac:

If you are using Espresso on an HPC cluster, please check if a Python 3 module 
with the necessary packages such as NumPy is available. If such a module is not 
available, please ask the cluster operators to install it.
On many clusters, the command "module avail" provides a list of loadable 

## Converting simulation scripts
There are some syntax differences between Python 2 and Python 3, but most 
simulation scripts can be converted in less than five minutes.
The most relevant ones for simulation scripts are:
- print is now a function
    x = 5
    print("x is", 5)
- Division of two integers returns a float. 5/2 equals 2.5 rather than 2 as in 
Python 2 and C. To get integer division, use 5//2
- range() in Python 2 returns a list of items, whereas it returns an iterator 
in Python 3. For-loops work as before, but if you need the actual list, use
    x = list(range(5))

The official documentation is at
There are also tools for automatic conversion:

Regards, Rudolf
Dr. Rudolf Weeber
Institute for Computational Physics
Universit├Ąt Stuttgart
Allmandring 3
70569 Stuttgart
Phone: +49(0)711/685-67717
Email: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]