Disclaimer: the following instructions are not part of an official Cantera distribution and are posted here in the hope that they will help others to compile Cantera from scratch in a Linux/conda environment. Steps require Cantera >= 2.6.0a4 and will not work for older versions. In case you should have suggestions for improvement, please feel free to leave comments (or post on the Cantera Users' group as usual).
Using the correct packages for the conda
environment is critical, as it will take care of the entire configuration.
Install mamba
$ conda install -c conda-forge mamba
Create the conda environment as
$ mamba create -n cantera-dev -c conda-forge sundials=6.0 scons numpy ruamel.yaml \
cython boost-cpp fmt eigen yaml-cpp libgomp openblas pytest ipython matplotlib h5py scipy jupyter
and activate this new environment using
$ conda activate cantera-dev
Change to a suitable folder used for compilation (instructions below use GitHub
, which should be a pre-existing folder), and clone the repository (or a fork thereof), e.g.
$ cd GitHub
$ git clone https://github.com/Cantera/cantera.git
$ cd cantera
Now that everything is set up, run
$ scons build
$ scons test
$ scons install
(note that there are no options necessary!). The installation ends with
Cantera has been successfully installed.
File locations:
applications /home/<user>/.conda/envs/cantera-dev/bin
library files /home/<user>/.conda/envs/cantera-dev/lib
C++ headers /home/<user>/.conda/envs/cantera-dev/include
samples /home/<user>/.conda/envs/cantera-dev/share/cantera/samples
data files /home/<user>/.conda/envs/cantera-dev/share/cantera/data
Python package (cantera) /home/<user>/.conda/envs/cantera-dev/lib/python3.10/site-packages
Python samples /home/<user>/.conda/envs/cantera-dev/lib/python3.10/site-packages/cantera/examples
Setup scripts to configure the environment for Cantera are at:
setup script (bash) /home/<user>/.conda/envs/cantera-dev/bin/setup_cantera
setup script (csh/tcsh) /home/<user>/.conda/envs/cantera-dev/bin/setup_cantera.csh
It is recommended that you run the script for your shell by typing:
source /home/<user>/.conda/envs/cantera-dev/bin/setup_cantera
before using Cantera, or else include its contents in your shell login script.
scons: done building targets.
Important: As the compiled code is based on the conda environment
cantera-dev
, it is only usable from within that environment. This means that in order to use your newly compiled Cantera version, you have to activate yourcantera-dev
environment first.