Skip to content

Instantly share code, notes, and snippets.

@ischoegl
Last active April 1, 2023 13:49
Show Gist options
  • Save ischoegl/b7c935bb3c94403f3f4d4e5db67ac116 to your computer and use it in GitHub Desktop.
Save ischoegl/b7c935bb3c94403f3f4d4e5db67ac116 to your computer and use it in GitHub Desktop.
Local cantera conda package

Creating a conda-bld environment

Prepare a dedicated conda-build environment:

$ conda create --name conda-bld conda-build

Installing conda packages built by GH Actions

Download artifacts and run:

$ conda index .

Build cantera conda package locally

While the recipe is meant to build automatically, the following instructions illustrate how to use this recipe to build conda packages locally.

Linux

Clone the conda-recipes repository and build the package for a given python and numpy version as:

$ cd path/to/conda-recipes
$ conda activate conda-bld
$ mkdir conda-bld

$ conda build ./cantera -m ./.ci_support/conda_build_config.yaml \
--no-anaconda-upload --python 3.9 --numpy 1.21

Towards the end od the build process, some instructions show the location of the package:

[...]
# To have conda build upload to anaconda.org automatically, use
# conda config --set anaconda_upload yes
anaconda upload \
    /opt/conda/envs/conda-bld/conda-bld/linux-64/libcantera-3.0.0a2-h3fd9d12_0.tar.bz2 \
    /opt/conda/envs/conda-bld/conda-bld/linux-64/libcantera-devel-3.0.0a2-h3fd9d12_0.tar.bz2 \
    /opt/conda/envs/conda-bld/conda-bld/linux-64/cantera-3.0.0a2-py39h6cd0baa_0.tar.bz2
anaconda_upload is not set.  Not uploading wheels: []
[...]

Note that in this case, the "channel" corresponds to /opt/conda/envs/conda-bld/conda-bld/.

Deactivate the build environment:

$ conda deactivate

Test the conda package

Create a bare environment

$ conda create --name ct-test
$ conda activate ct-test

Install the local package and test that everything works correctly:

$ conda install -c file:///opt/conda/envs/conda-bld/conda-bld/ cantera
$ python
[...]
>>> import cantera as ct
>>> ct.__version__

Miscellaneous

Note As an aside, the current conda environment can be summarized by conda env export --from-history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment