Concepts
-
Conda
Package manager
-
Anaconda
A pre-built distribution of Python and other packages for data science
Cheatsheet
Set up shell environment
# e.g. conda init bash or conda init zsh
# This will append the conda initialization script into the end of your .bashrc or .zshrc file.
conda init $shell_nameDisplay info about conda
# Display info about conda
conda infoCreate an environment by importing an environment definition file
conda env create -f $env_yamlCreate an environment with specified Python version
# Create a new environment
conda create -n $env_name python=$python_versionList all environments
conda env listExample:
> conda env list
# conda environments:
#
C:\Users\Takechiyo\scoop\apps\miniconda3\25.7.0-2
base * C:\Users\Takechiyo\scoop\apps\miniconda3\current
deltalake-minimal C:\Users\Takechiyo\scoop\apps\miniconda3\current\envs\deltalake-minimal
python C:\Users\Takechiyo\scoop\apps\miniconda3\current\envs\pythonDetermine the current active environment
# The active environment is labelled with asterisk.
conda env listActivate an existing environment
# Activate the environment
conda activate $env_nameDeactivate the current environment
conda deactivateRemove all packages in an environment
The environment must be deactivated first.
conda deactivate
conda remove -n $env_name --all --keep-envInstall a package in an environment
conda install -n $env_name "$package_name=$version"Determine Python version of an environment
conda list -n $env_name -f pythonChange Python version of an existing environment
conda install -n $env_name python=$python_versionDisplay dependencies of an environment
conda list -n $env_nameExport an environment to an environment definition file
conda export -n $env_name -f $env_yamlRemove an environment
conda env remove -n $env_name