Skip to main content

Conda/Mamba #


Managing Environments #

Toggling channel priority:

# see the current setting
$ conda config --describe channel_priority

# set to flexible if environment conflict just won't resolve
$ conda config --set channel_priority flexible

# set to strict if feeling lucky
$ conda config --set channel_priority strict

Create an environment from file:

$ conda env create --file environment.yml
$ conda env create -f environment.yml

Update an environment:

$ conda env update

Delete an environment:

$ conda remove --name my-env --all --yes
$ conda remove -n my-env --all -y

Manage Jupyter Notebook Installation #

  - ipykernel

  # If need Jupyter Lab
  - jupyterlab

  # If need extensions
  - jupyter_contrib_nbextensions
  … (List of extensions that need installation)

Managing Packages #

Check Package Version #

$ conda list --full-name <package-name>

Force Re-installation #

First, deactivate the current environment and activate again.

If that doesn’t work:

$ conda install --force-reinstall <a-bad-package>

If that doesn’t work:

  1. Open conda’s package directories. (example: Miniconda)
    • Check: conda info
    • /opt/miniconda3/pkgs/
    • /opt/miniconda3/envs/my-env/lib/python3.7/site-packages/
  2. Remove the package.
  3. Run conda env update.

If that doesn’t work:

  1. Switch to base environment or run conda deactivate
  2. Delete my-env with conda remove -n my-env --all -y
  3. Create it again with conda env create -f environment.yml