Installation

Requirements

At least Python 3.12 is required to run ComPyTools with the following packages:

  • Astropy: for displaying data in tabular form and to attach metadata and units to the data. We also use physical constants defined within astropy,

  • Matplotlib: for plotting EoS data,

  • Pandas: for writing out tabulated data into text files,

  • Rich: for log output and tabulating metadata information.

  • Scipy: for performing numerical integration.

The optional package Jupyterlab is also available for those who wish to run ComPyTools via a notebook.

Additional libraries are also needed in order to build and install ComPyTools:

  • CompOSE: a set of Fortran routines for computing the interpolated tables. This is included as part of the ComPyTools package,

  • cmake and make: for compiling the CompOSE Fortran routines,

  • gfortran: compiler for the Fortran routines,

  • micromamba or conda: for creating the software environment within which to install ComPyTools.

Using pip

The first step is to create an environment within which to install the minimum required version of Python and the software needed to build and install ComPyTools.

Note

You can use conda in the following steps if you already have it. However, micromamba is a faster, drop-in alternative to conda. If you don’t already have micromamba installed on your machine, you can install it with the command "${SHELL}" <(curl -L micro.mamba.pm/install.sh) for MacOS and Linux systems. Further information can be found here.

To create the environment run the following command in your terminal:

conda create -n compytools-env -c conda-forge python=3.12 cmake make gfortran

and then activate it with:

conda activate compytools-env

Note

When the environment is no longer needed it can be deactivated with conda deactivate.

Finally, ComPyTools can be installed with:

pip install compytools

If you wish to run ComPyTools within a Jupyter lab notebook, you can install ComPyTools with

pip install compytools[jupyter]

For developers

For those who wish to make developments to the code, the repository can be cloned with

git clone --recursive https://gitlab.in2p3.fr/lpc-caen/compytools.git

and then enter the code directory with

cd compytools

The environment can be created and activated using

conda create -n compytools-env -c conda-forge python=3.12 cmake make gfortran
conda activate compytools-env

Finally, the package can be installed (with additional packages needed for developments) with

pip install -e .[dev]

To check that the installation proceeded correctly, the unit tests can be run with:

python -m pytest