Installing PyChaste
On this page
There are three ways to get PyChaste running on your system:
- Using the Conda Package – supported on Linux.
- Using the Docker Image – supported on any platform.
- Building from Source – supported on Linux.
Conda Package
The conda package installs several dependencies automatically. Please install
mamba
first, as dependency resolution can be
quite slow with conda
itself.
We recommend that you install in a new environment. To do this, run:
mamba create -n <env-name> -c pychaste -c conda-forge chaste
where <env-name>
is the name of the new environment. To activate the environment, run:
conda activate <env-name>
Alternatively, you can install in an existing conda environment. With the environment activated, run:
mamba install -c pychaste -c conda-forge chaste
Note
Trying to install in an existing environment may fail if it already has conflicting dependencies installed!
Optionally, you can install and launch a Jupyter notebook from the environment:
mamba install -c conda-forge jupyterlab
jupyter lab
Docker Image
The docker image comes with PyChaste and Jupyter pre-installed. If you do not already have docker installed, please follow the instructions to get docker.
With docker installed, you can pull the image and launch a PyChaste container with the following command:
docker run -it --init --rm -p 8888:8888 chaste/pychaste
You can open a Jupyter notebook from the container by launching a web
browser and going to the address http://localhost:8888
.
Build from Source
To build PyChaste from source, we first need to install Chaste. See the Chaste Install Guides for information on installing Chaste dependencies.
After installing the required dependencies, clone the Chaste repository:
git clone --recursive https://github.com/Chaste/Chaste.git
Clone the PyChaste repository into the Chaste projects directory:
git clone --recursive https://github.com/Chaste/PyChaste.git /path/to/Chaste/projects/PyChaste
Note
--recursive
is important for retrieving git submodules. The build will fail
without it!
From outside the source tree, create a build folder and generate the CMake configuration:
mkdir build && cd build
cmake /path/to/Chaste
To build PyChaste, run:
make -j4 chaste_project_PyChaste
make -j4 chaste_project_PyChaste_Python
Finally, pip install
the built package with these commands:
cd /path/to/build/projects/PyChaste/python/chaste
pip install .
See Also