Conda environment

[this page is adapted from https://aaltoscicomp.github.io/python-for-scicomp/installation/]

You only need this if you wish to go through examples and exercises during the second workshop week on your own computer.

Choosing an installation method

For this course we will install an isolated environment with following dependencies:

name: coderefinery
channels:
  - conda-forge
  - defaults
  - bioconda
dependencies:
  - python>=3.10
  - click=8.1.7
  - ipywidgets=8.1.2
  - jupyterlab=4.1.2
  - jupyterlab-git=0.50.0
  - matplotlib=3.8.3
  - myst-parser=2.0.0
  - nbdime=4.0.1
  - numpy=1.26.4
  - pandas=2.2.1
  - pytest=8.0.2
  - pytest-cov=4.1.0
  - seaborn=0.13.2
  - snakemake-minimal=8.5.3
  - pulp<2.8.0
  - sphinx=7.2.6
  - sphinx-autobuild=2024.2.4
  - sphinx_rtd_theme=2.0.0
  - sphinx-autodoc2

If you have a tool/method that works for you, keep using it

If you are used to installing Conda packages and know what to do with the above files, please follow your own preferred installation method.

If you are new to Conda or unsure how to create isolated environments from files above, please follow the instructions below where we do this with the help of Miniforge.

If you already use Anaconda to manage your software environments, please continue using it. In this case you can skip Installing Miniforge and go directly to Installing the software environment.

Installing Miniforge

Download the latest release from the Miniforge download overview. This installs the base, and from here other packages can be installed.

Unsure what to download and what to do with it?

You want to download and run Miniforge3-Windows-x86_64.exe.

Installing the software environment

First we will start a command line environment in a way that activates conda/mamba. Then we will install the software environment from this environment.yml file (this is the same file as on top of this page).

An environment is a self-contained set of extra libraries - different projects can use different environments to not interfere with each other. This environment will have all of the software needed for this particular course.

We will call the environment coderefinery.

Use the “Miniforge Prompt” to start Miniforge. This will set up everything so that conda and mamba are available. Then type (without the $):

$ curl "https://raw.githubusercontent.com/coderefinery/software/main/environment.yml" -o environment.yml 
$ mamba env create -n coderefinery -f environment.yml

Activating the software environment

Start the Miniforge Prompt. Then type (without the $):

$ conda activate coderefinery
$ jupyter-lab

How to verify the environment

Make sure you are in the Miniforge prompt (Windows) or in a terminal (Linux/MacOS).

The following command should return a version number and not an error message:

$ conda --version

Is the coderefinery environment installed?

$ conda env list

Make sure it’s activated (Activating the software environment). Once activated, try the following commands.

You should see versions printed and not see errors (exact version numbers are not too important):

$ jupyter-lab --version

4.1.2
$ pytest --version

8.0.2
$ sphinx-build --version

sphinx-build 7.2.6
$ snakemake --version

8.5.3

Removing the software environment

In the Miniforge Prompt, type (without the $):

$ conda env list
$ conda env remove --name coderefinery
$ conda env list