Before installation: download the opacity data

Before you install pRT, please download the opacity data, at least the low-resolution version (\(\lambda/\Delta\lambda=1000\)), as it provides all relevant input files for pRT to run, and contains the necessary folder structure if you want to install high-resolution opacities later (\(\lambda/\Delta\lambda=10^6\)).

Thus, to get started download the opacity and input data (12.1 GB), unzip them, and put the “input_data” folder somewhere on your computer (it does not matter where).

Next, please add the following environment variable to your “.bash_profile”, “.bashrc”, or “.zshrc” file (depending on your operating system and shell type) by typing

echo 'export pRT_input_data_path="absolute/path/of/the/folder/input_data"' >>~/.bash_profile

for Mac OS and

echo 'export pRT_input_data_path="absolute/path/of/the/folder/input_data"' >>~/.bashrc

for Linux. Now you are ready to go and can proceed with the actual installation of pRT.


Don’t forget to adapt the path in the line above! If you are uncertain what the absolute path of the input_data folder is, then switch to that folder in the terminal, type “pwd”, and press Enter. You can then just copy-paste that path. Then close and reopen the terminal such that it will read the environment variable correctly.

If you want to also use high-resolution opacity data please follow these steps here, but note that they can be installed at any point after the pRT installation:

The high resolution (\(\lambda/\Delta\lambda=10^6\)) opacity data (about 240 GB if you want to get all species) can be accessed and downloaded via Keeper here. To install them, create a folder called “line_by_line” in the “input_data/opacities/lines” folder. Then put the folder of the absorber species you downloaded in there.

If you want to run retrievals: install Multinest

If you want to use pRT’s retrieval package, you need to install Multinest. This is because for retrievals pRT uses the PyMultiNest package, which is a Python wrapper of the nested sampling code called MultiNest. To install Multinest, please follow the instructions provided on the PyMultiNest website.

After installation, it is important to copy the resulting library files to a location where PyMultiNest can find them. In that case you also need to copy the multinest/lib/* files generated during the installation into the lib folder that your Python binary sees. If you use anaconda, this folder should be called something like /opt/miniconda3/envs/name_of_your conda_environment/lib/, at least on a Mac. The solution suggested on the PyMultiNest website (“Include the lib/ directory in your LD_LIBRARY_PATH”) does not appear to work, at least not on a Mac.

Installation of petitRADTRANS via pip install

To install pRT via pip install just type

pip install petitRADTRANS

in a terminal. Note that you must also have downloaded the low-resolution opacities either before or after to actually run pRT, see above.

Compiling pRT from source

Download petitRADTRANS from Gitlab, or clone it from GitLab via

git clone
  • In the terminal, enter the petitRADTRANS folder

  • Execute the following command in the terminal: pip install .

Windows 10 and 11 instructions

The installation of pRT on Windows machines, just as in the Linux/Mac case, requires C and Fortran compilers. Those can be obtained from, for example, MSYS2 or Visual Studio. The installation process is otherwise the same as in Linux.

Important note: MultiNest retrievals, that are used by default in pRT, will not work as is on Windows. This is because MultiNest requires the LAPACK and OpenMPI libraries to function. Installing LAPACK on Windows can be a tedious process, and OpenMPI support on Windows has been discontinued, meaning that it is not possible to run MultiNest retrievals in parallel, increasing significantly computation times. This can be overcome by using WSL (see below).

Using WSL: it is highly recommended to use the Windows Subsystem for Linux (WSL) in order to make the most out of pRT on Windows. Follow the WSL installation instructions from the previous link, then install pRT from the WSL terminal, following the same steps as in the Linux case. It is also highly recommended to put the “input_data” folder on the WSL side to get the fastest performances during retrievals.

pRT can be installed both on the Windows and WSL sides. Files on WSL can be accessed from the Windows side using the path \\wsl$\, and files on Windows can be accessed from the WSL side using /mnt (e.g., to get into “C:\Users” from WSL: cd /mnt/c/Users). Note however than accessing files across sides is slow.

Apple M1 instructions

The installation of pRT on Apple machines with the M1 chip requires Intel emulation with Rosetta.

softwareupdate --install-rosetta

Now go to the Applications folder and find the iTerm icon. Make a copy of this application and name the new copy as something like “iTerm_Rosetta”. Right click iTerm_Rosetta, choose “Get Info”, and select the “Open using Rosetta” box. To test that you are indeed using the Intel emulator, type the following in your iTerm_Rosetta:


This command should return i386.

Next, install homebrew with Rosetta:

/bin/bash -c "$(curl -fsSL"

With the Intel emulation, Homebrew should be installed at /usr/local/bin/brew. Add the following to your .bash_profile

alias brew_i386="/usr/local/bin/brew"

In the future, you will use brew_i386 as an alternative of brew with the Intel emulation.

For completeness only, you might also install Homebrew in your M1 terminal, which should be then installed at /opt/homebrew/bin/brew. Add the following to your .bash_profile

alias brew="/opt/homebrew/bin/brew"

Now we will install miniconda3 in Rosetta, but before that, we will have to modify .bash_profile so we could handle the conda between M1 and Rosetta separately. Here I assume you already installed anaconda in your M1 terminal, so the following block should be in your .bash_profile:

 # >>> conda initialize >>>
 # !! Contents within this block are managed by 'conda init' !!
 __conda_setup="$('/Users/xxxx/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
 if [ $? -eq 0 ]; then
    eval "$__conda_setup"
    if [ -f "/Users/xxxx/anaconda3/etc/profile.d/" ]; then
        . "/Users/xxxx/anaconda3/etc/profile.d/"
        export PATH="/Users/xxxx/anaconda3/bin:$PATH"
unset __conda_setup
# <<< conda initialize <<<

Note that the “xxxx” here should be your username. Let’s cut these few lines and paste them into a separate file in the home directory. We will come back to handle this file later.

Now let’s install miniconda3 in Rosetta. First, type the following line in iTerm_Rosetta:

curl -L >

Then type the following and follow instructions to proceed with the installation:


Once the installation succeed, you will see that the following several new lines have been added to .bash_profile:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/xxxx/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
    if [ -f "/Users/xxxx/miniconda3/etc/profile.d/" ]; then
        . "/Users/xxxx/miniconda3/etc/profile.d/"
        export PATH="/Users/xxxx/miniconda3/bin:$PATH"
unset __conda_setup
# <<< conda initialize <<<

Let’s cut these few lines again and paste them into a separate file in the home directory. In the same iTerm_Rosetta, type the following:

conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge

Okay, now we are ready to go ahead mofify .bash_profile to handle two versions of conda between M1 and Rosetta terminals. Add the following lines to your .bash_profile:

# <<<<<< Added by TR 20220405 <<
arch_name="$(uname -m)"

if [ "${arch_name}" = "x86_64" ]; then
    echo "Running on Rosetta using miniconda3"
    source ~/
elif [ "${arch_name}" = "arm64" ]; then
    echo "Running on ARM64 using anaconda"
    source ~/
    echo "Unknown architecture: ${arch_name}"
# <<<<<<<< end <<<<<<<

Now, when you open iTerm / iTerm_Rosetta, you will instantly know which conda version is being used.

Next, we should install the following packages in miniconda3:

conda install ipython
conda install numpy
conda install jupyter
conda install -c conda-forge pymultinest

Then, we install gfortran in iTerm_Rosetta:

brew_i386 install gfortran

Everything is ready now, so we should simply install pRT as follow:

pip install petitRADTRANS

Testing the installation

Open a new terminal window (this will source the pRT_input_data_path). Then open python and type

from petitRADTRANS import Radtrans
atmosphere = Radtrans(line_species = ['CH4'])

This should produce the following output:

 Read line opacities of CH4...

Common issues

It may happen that after installation you get the following error message when trying to import pRT:

ImportError: cannot import name 'fort_input' from partially initialized module 'petitRADTRANS' (most likely due to a circular import)

This usually occurs if there are multiple (conflicting) Python installations. In this case, we recommend installing pRT in a new (clean) Python environment (e.g., using conda).