Installing Clawpack

See also:

Prerequisites: Before installing, check that you have the Installation Prerequisites.

pip install

The recommended approach is to use pip install. It is also possible to have multiple versions of Clawpack installed and switch between them (i.e., modify your Python path) using pip. (see pip install instructions) If you plan to do this, or if you also wish to directly use the Fortran variants of Clawpack (classic, AMRClaw, and/or GeoClaw), then we recommend using the following version of the pip install command (you might want to first read the notes below to see if you want to change anything in this command):

pip install --src=$HOME/clawpack_src --user -e \

This will download Clawpack (via a git clone) into the directory $HOME/clawpack_src/clawpack-v5.6.1. The top installation directory can be changed by modifying the --src target (or omit this part to put it in your current working directory). If you have already downloaded Clawpack via a different mechanism then see Using pip to install a different version rather than using the above command.

See Clawpack components for a list of what’s included in this top level directory.

Note: Using pip to install will also check some python Installation Prerequisites and may update these on your system, and will use f2py to convert Fortran Riemann solvers to Python versions. See Other Installation Options if you want more control.

The --user flag is necessary if you are installing on a shared computer where you do not have root access. If you do have root access and want it to be available to all users, you can omit this flag.

The -e flag makes it an “editable” install, leaving the source code in place and allowing you to modify it if desired. (Otherwise, by default, pip would move the python code to some site-packages directory and delete everything else.)

In order to use the Fortran codes within Clawpack, you should then set the environment variable CLAW to point to the clawpack-v5.6.1 directory within the installation directory $HOME/clawpack_src, and FC to point to the desired Fortran compiler, e.g. in the bash shell:

export CLAW=$HOME/clawpack_src/clawpack-v5.6.1
export FC=gfortran

See Set environment variables for more information.

For more discussion of pip installation, and troubleshooting hints, see pip install instructions.

Other Installation Options

In general, installing Clawpack requires downloading some version and then setting paths so that Python import statements (and possibly Fortran Makefiles) find the desired version. Switching between versions already on your computer simply requires resetting paths. For hints and troubleshooting, see:

Rather than using pip, there are several other options for using Clawpack that may be useful depending on your needs. These are summarized in Additional options for installing Clawpack, including:

Python path: If you download a tarfile or use git clone to download a version, you can still use pip install to set the Python path appropriately. See pip install instructions for details.

If you are not using pip to set paths, then you will need to set the PYTHONPATH environment variable to point to a particular version of Clawpack, but this is not recommended. See Python path for more details and tips on sorting out your path.

Components: See Clawpack components for a list of what is generally included under the top level clawpack directory when using any of the approaches below. (And what is not included, e.g. the Clawpack Applications repository.)

Next steps:

Once Clawpack is installed, you can go to one of the following pages to get started: