Doing things with conda environments


Teresa Kubacka


October 8, 2022

Update the Python version

It’s scary, but needs to be done sometimes (e.g. when you have a perfectly working old environment built on Python 3.6, but then one dependency stops behaving and requires P3.8+).

If in a conda environment:

conda activate my_env
conda install -c anaconda python=<version>


Clone an environment

If you want to make a clone of the environment for a backup purpose:

conda create --name <target_environment> --clone <source_environment> 

If you want to clone the base:

conda create --name <myenv> --clone base

Solve the libarchive error

  • install miniconda to a separate folder. Tell it not to run conda init
  • activate that installation with source /path/to/new/miniconda/bin/activate
  • run conda install -p /path/to/broken/anaconda –force python-libarchive-c conda-package-handling libarchive

Similar here:

Install packages when creating environment

Packages can be defined at env creation, which supposedly helps with resolving conflicts


List environments:

conda info --envs 

Install ipykernel pointing to a venv:

pip install ipykernel 
python -m ipykernel install --name my_venv