Build in a conda environment

Creating a dedicated Conda environment is a best practice that ensures the dependencies are managed effectively. This isolation prevents conflicts between packages and allows for a clean workspace. In the following section, we’ll guide you through the process of setting up a Conda environment and installing FastDDM to get your project up and running smoothly.

  1. Install miniconda

  2. Create an environment config YAML file

  3. Notes on CUDA

Install miniconda

Download and install miniconda3 from the Anaconda website.

Create an environment config YAML file

Create a fastddm-env.yml file and write the following content in it (select your operating system).

name: fddm-env
channels:
  - defaults
dependencies:
  - gcc
  - g++
  - python>=3.8
  - pip

Create the environment by running the following command in your terminal

$ conda env create -f fastddm-env.yml

Activate the environment

$ conda activate fddm-env

Export the environment variables

$ conda env config vars set CC=$CONDA_PREFIX/bin/gcc
$ conda env config vars set CXX=$CONDA_PREFIX/bin/g++

To compile the C++ core, also set the corresponding flag

$ conda env config vars set ENABLE_CPP=ON

Deactivate and reactivate the environment to make the changes effective

$ conda deactivate
$ conda activate fddm-env

From the fastddm project root directory (see Building from source on how to get the source code), install the package and the test dependencies

$ pip3 install ."[test]"

Finally, run the tests from the project source directory

$ pytest -v

Notes on CUDA

As of today, we could not find a way to automatically build the package from source using the cudatoolkit-dev distributed on conda-forge. We recommend following the instructions given in Building from source to install the package in the conda environment using the system CUDA Toolkit.

We welcome contributions on this matter!