Conda Cheat Sheet

 

Setting up conda environment

Create/Remove Conda Environment

List all Python versions:

conda search "^python$"

List all environments:

conda info --envs

Create/Remove an environment of Python 3.6.4 (with additional packages):

conda create --name py364 python=3.6.4
conda create --name py364_numpy python=3.6.4 numpy
conda remove --name py364 --all

Install nb_conda:

conda install nb_conda

Activate/Deactivate the environment

Activate the Python environment:

source activate py364

Deactivate the Python environment:

source deactivate

Clone/Rename Environment

The environment cannot be renamed but can be cloned:

conda create --name new_name --clone old_name
conda remove --name old_name --all

The command re-downloads packages, using –offline flag to disable it.

Managing conda packages

There are two ways to manage the Python packages with conda:

.(1) Using conda to add/remove packages

Add packages to specific environment:

source activate py364
conda install --name py364 numpy
conda list

.(2) Using pip to add/remove packages:

source activate py364
pip install numpy
pip list

Reference

Anaconda installation: https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-16-04

Clone/Rename the Conda environment: https://stackoverflow.com/questions/42231764/how-can-i-rename-a-conda-environment