Getting Started with Conda

_src_use_of_tools/_static/conda_logo.svg

This page outlines the fundamentals in using the conda package manager.

Package, dependency and environment management for any language—Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN, and more.

Tip

Conda has its own cheat sheet available for download pdf

Choosing a Conda Flavour

When using the conda package manager, you have two options to choose from:

Warning

Python 3.X version of the installer must be chosen. Python 2 has reached its End Of Life (EOL) and therefore we do not support it, and do not plan to.

The following table summarises the differences between available installers. We recommend you to choose what you feel most comfortable with.

Component/Feature

Miniconda

Anaconda

Conda Package Manager

Bundled Packages [info]

Graphical User Interface

Note

The Graphical User Interface (Anaconda Navigator) can be installed separately in Miniconda.

Note

For students of Numerical Astrodynamics it is recommended that you install Anaconda.

Installation

Please see the Installation guide provided by the Anaconda documentation.

Managing Conda

Command-line & GUI use

On Unix system (Linux and Mac), conda should be integrated with the terminal. On Windows, you can find a program called Anaconda Navigator and Anaconda Prompt in the Windows search. The Anaconda Prompt is equivalent to the terminal use of conda on Unix. Some Unix commands are made available in this prompt, although most usage is equivalent to the Windows shell. On Unix you can start Anaconda Navigator with the following command:

anaconda-navigator    # base environment should be active

Verify Conda is Installed via Terminal/Anaconda Prompt.

conda --version

Managing Environments

Create a new environment

Generally Python 3.7 is preferred when using the tudat-space ecosystem.

conda create --name myenv python=3.7

Create an environment from an environment.yml file

An environment can be defined in an environment.yml file as:

name: tudat-space
channels:
  - conda-forge
  - tudat-team
dependencies:   # these are available on anaconda.org
  - tudatpy
  - matplotlib
  - pip         # pip can be added as a dependency!
  - pip:        # packages only available on PyPi can be added:
    - rtcat_sphinx_theme
    - sphinxcontrib-contentui
  1. Create the environment from the environment.yml file in the current directory:

conda env create -f environment.yml
  1. Activate the environment (the name of the environment is defined on the first line of the environment.yml):

conda activate tudat-space
  1. Verify the installation of the packages listed in environment.yml.

conda env list

Export an environment

  1. Your current active environment can be exported into the current directory as follows:

conda env export > environment.yml

Delete an environment

Warning

The following command is not reversible unless the environment has been exported beforehand.

  1. Remove the environment and all its packages:

conda remove --name myenv --all
  1. Verify that the environment has been removed:

conda env list

Managing Packages

Installling a package

  1. Add the channel indexing the package (if required):

conda config --append channels tudat-team
  1. Install the package:

conda install tudatpy

Note

Alternatively, if you do not want to add a channel and potentially cause package conflicts, if available on multiple sources, you can isolate the channel for the package serach as follows:

(1&2). Install a package from a specific channel:

conda install tudatpy -c tudat-team