Installation

Stable release

Note

The GFS dynamical core has been made into a seperate package called gfs_dynamical_core for ease of maintenance.

If you need the dynamical core, please install this package from source or directly using pip. Doing this will automatically install climt as well.

$ pip install gfs_dynamical_core

You can install climt by simply typing

$ pip install climt

This is the preferred method to install climt, as it will always install the most recent stable release. On Ubuntu Linux, you might need to prefix the above command with sudo. On Mac, it is recommended to use the anaconda python distribution to make installation simpler.

What pip install climt installs

climt itself is pure Python. It brings in a companion package, climt-fortran, which carries the Fortran-backed components (RRTMG, the Fortran Emanuel convection scheme, SimplePhysics and the DCMIP initial conditions):

  • on Linux (x86-64) and macOS on Apple silicon (macOS 15 or newer), for CPython 3.10–3.12, climt-fortran is a compiled wheel and everything works;
  • everywhere else it is an empty stub. Components that need Fortran raise a clear error when you try to use them; everything else works, including the CORK correlated-k radiation scheme.

To check at runtime:

import climt
climt.has_fortran_extensions()   # False with the stub
climt.list_components()
name                            kind                       available  requires  source
CorkLongwaveRadiation           TendencyComponent          True                 climt
EmanuelConvection               ImplicitTendencyComponent  True                 climt
RRTMGLongwave                   TendencyComponent          True                 climt
SimplePhysics                   Stepper                    True                 climt
...
climt-fortran: available, version 1.0.0
numba: installed

The climt-fortran: line says whether the companion is available, missing, a stub without binaries, broken (with the reason it failed to load) or an interface_mismatch with this version of climt. climt.show_versions() reports the same reason on its fortran_extensions line.

If an installed binary is faulty (for example it fails to load against your NumPy), remove it with pip uninstall climt-fortran; climt keeps working without the Fortran components. To build the binaries from source instead (needs gfortran and a C compiler), replacing the stub or a faulty binary:

$ pip install --force-reinstall --no-deps --no-binary climt-fortran climt-fortran

--force-reinstall is needed because pip otherwise considers the installed stub or binary to satisfy the requirement and does nothing.

Some pure-Python components run much faster with numba, which is an optional extra:

$ pip install "climt[numba]"
NoteWindows is not tested

climt no longer builds or tests Windows binaries. On Windows climt-fortran installs as the empty stub, so climt installs without a compiler but has no Fortran components. Building from source on Windows may still work but is unsupported — if you need the compiled components there, the Windows Subsystem for Linux is the recommended route.

Note

If you are not using Anaconda, please ensure you have the libpython library installed. See the next section for instructions to install libpython.

Since by default pip attempts to install a binary wheel, you won’t need a compiler on your system.

If you don’t have pip installed, this Python installation guide can guide you through the process.

Installing from source

The sources for climt can be downloaded from the Github repo.

You can either clone the public repository:

$ git clone git://github.com/CliMT/climt

Or download the tarball:

$ curl  -OL https://github.com/CliMT/climt/tarball/master

Once you have a copy of the source, you can install it with:

$ pip install -r requirements_dev.txt
$ pip install ./fortran    # builds the Fortran components
$ pip install -e .

Until climt-fortran 1.0.0 is published on PyPI, pip install ./fortran is required before pip install -e ., which otherwise fails because pip cannot find a climt-fortran to satisfy climt’s dependency. Without a Fortran toolchain, install the stub instead:

$ CLIMT_FORTRAN_STUB=1 pip install ./fortran

Once climt-fortran is on PyPI you may skip this step and let pip install the published package. These commands may require the use of sudo.

Dependencies for source installations

climt depends on some easily installable libraries. For an installation from source, it also requires that C and fortran compilers be installed.

On Ubuntu Linux, for example, these dependencies can be installed by:

$ sudo apt-get install gcc
$ sudo apt-get install gfortran
$ sudo apt-get install python-dev
$ sudo pip install -U cython
$ sudo pip install -U numpy

use pip3 and python3-dev if you use Python 3.

On Mac OSX, it is recommended that you use anaconda as your python distribution. This will eliminate the need to install cython, numpy and python-dev. Once you have anaconda installed, you will need to do the following:

$ brew install gcc
$ export CC=gcc-x
$ export FC=gfortran-x

Where gcc-x,gfortran-x are the names of the C,Fortran compilers that Homebrew installs. Exporting the name of the compiler is essential on Mac since the default compiler that ships with Mac (called gcc, but is actually a different compiler) cannot compile OpenMP programs, like the dynamical core in climt.