How to use conda-pack to relocate your conda environment?


conda activate my_envconda install conda-pack
# This stores the output my_env.tar.gz at current location
conda pack -n my_env
# Alternatively, provide output location
conda pack -n my_env --output /dir/to/my_env.tar.gz
mkdir -p /dir/to/miniconda3/envs/my_env
tar -xzf my_env.tar.gz -C /dir/to/miniconda3/envs/my_env
cd /dir/to/miniconda3/envs/my_env
source my_env/bin/activate
source my_env/bin/deactivate
conda env list
conda activate my_env

Method 2: Sharing the .yml file with the specific version of packages

conda env export > environment.yml
conda env create -f environment.yml
conda env export | cut -f -2 -d “=” | grep -v “prefix” > environment.yml

Method 3: clone an environment — doesn’t really work

conda create --name myclone --clone myenv
Photo by Tyler Nix on Unsplash



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store