Working with Conda

What is Conda ?

Conda is an open-source package and environment management system that runs on Windows, macOS and Linux. Conda quickly installs, runs and updates packages and their dependencies. Conda easily creates, saves, loads and switches between environments on your local computer.

It was created for Python programs, but it can package and distribute software for any language.

References :

Why you should use conda on GRICAD clusters ?

  • To work with IA main frameworks including : tensorflow, tensorflow-gpu, keras, torch, torchvision, pycuda

First steps

To use Conda you have to activate it running the following script:

source /applis/environments/conda.sh

You can list all availables environments typing:

conda env list

Pick an environment from this list and activate with the conda activate command. The following command activate a conda environment which includes Torch framework version 1.x for python 3.

conda activate torch1.X_py3

You can find a set of Conda commands here.

Creation of a Conda virtual environment

It is possible that none of the environments listed will meet your needs. For this reason you can create your own Conda environment.

To do this:

$ conda create --name $ENVIRONMENT_NAME python tensorflow

You have to replace $ENVIRONMENT_NAME by the name of the environment you want to create. You can add all the packages to install in your environment, after python (here the environment will contain python and tensorflow).

Creating an environment can be time and resource consuming. Don’t forget to connect to the compute node via the oarsub command.

To create an environment from an environment.yml file:

$ conda env create -f environment.yml

The content of environment.yml is of the form:

name: env-name
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.7
  - tensorflow

You can visit this page to find more specific environment creation commands.