Skip to content

Transitioning from RMG 2 to RMG 3

Mark Payne edited this page Feb 27, 2020 · 2 revisions

The RMG 3.0.0 release includes many backward-incompatible changes. Most importantly, RMG now requires Python 3.7 or newer, and will no longer run on Python 2. In addition, we took this opportunity to standardize naming conventions in RMG’s API, so any software using the API will need to be updated as well.

Updating a binary installation of RMG

If you are using the binary installation with Anaconda, you will need to create a completely new Python 3 environment to get the latest version of RMG. You do not need to install a separate version of Anaconda, because all Anaconda versions can create environments with either Python. However, you could choose to do so if you would like to start from scratch with a new install. This could be beneficial if your Anaconda installation is very old.

You can create a new environment using the following command:

conda create -c defaults -c rmg -c rdkit -c cantera -c pytorch -c conda-forge --name rmg_env rmg rmgdatabase python=3.7

Each -c flag indicates a conda channel to source packages from. You can change the --name argument if you would like to create a separate environment from an existing RMG 2 environment, e.g. --name rmg_py3.

If you would like to replace your existing RMG 2 environment, you will need to manually delete the existing environment first. You can do so with the following command:

conda remove --name rmg_env --all

Updating a source installation of RMG

If you are compiling from source, you can update the source code like usual by pulling from GitHub, but you will also need to create a new Python 3 conda environment.

Once you have updated the source code, create a new environment using the following command while you are in the RMG-Py directory:

conda env create -f environment.yml

By default, this will name the environment rmg_env. If you already have an rmg_env, you can either replace it by first deleting the existing environment using

conda remove --name rmg_env --all

or creating a separate environment (with a name of your choosing) by using

conda env create -f environment.yml --name rmg_py3

Updating software using RMG API

If you have written and software, scripts, or IPython notebooks using RMG's API, they will most likely need to be updated in order to work. You will need to ensure that your software is compatible with both Python 3 and RMG 3.

For Python 3 compatibility, you can follow standard Python 2 to 3 transition guides. The python-future package includes useful transition scripts and documentation at https://python-future.org/.

For RMG 3 compatibility, we have provided a helper script (rmg2to3.py) to assist with the renaming process. The docstring in the script provides detailed information on how to use it.

If you only run RMG jobs and scripts, nothing has changed in how that’s done.