Table of Contents


Quick commands

# Create a new environment from a yaml config file
conda env create -f env.yml -n <env_name>

# Create a new environment and manually specify the packages
conda create -n <env_name> python=3.6 pip=20 notebook

# List all environments
conda env list

# Remove an environment (but not its Jupyter kernel mapping)
conda remove --name <env_name> --all

# List all packages in an environment
conda list -n <env_name>

# See how much space you'd free if you removed unused packages from the cache
conda clean --packages --dry-run

# Actually free said space
conda clean --packages

# Other `conda clean` options
conda clean --all --dry-run
conda clean --index-cache --dry-run
conda clean --tarballs --dry-run
conda clean --tempfiles --dry-run

– via Conda Docs

Sample environment file

channels:
  - conda-forge
dependencies:
  - python=3.7
  - pip=20
  - lightgbm=3
  - notebook
  - pip:
      - azureml-sdk[notebooks]==1.17
      - scikit-learn==0.23
      - pandas==1.1
      - mlxtend==0.17
      - pandas-profiling==2.9
      - mlflow==1.11

Create a new Jupyter kernel for a Conda env

conda activate <your_conda_env>
pip install --user ipykernel
python -m ipykernel install --user --name=<your_conda_env_but_can_be_something_else_too>