Move all packages of anaconda env
migrate an Anaconda environment to another computer without needing to download any packages
On the Source computer
Clone your Anaconda environment
1 | conda create --name cloned_env --clone your_env_name |
Pack the cloned environment
Anaconda provides a tool called conda-pack to package
environments for transfer. If you don't have conda-pack
installed, you can install it using conda:
1 | conda install -c conda-forge conda-pack |
After installing conda-pack, use it to package your
cloned environment:
1 | conda activate cloned_env |
Transfer the package
On the target computer
Unpack the environment:
Once you've transferred the tarball to the target computer, unpack it into a new directory. First, create a directory for the environment, then unpack the tarball into it.
1 | tar -zxvf cloned_env.tar.gz -C ~/anaconda3/envs/env |
Activate the environment:
Before using the environment, you need to activate it. This step also corrects paths and makes the environment fully functional on the new computer.
1 | source ~/my_environments/cloned_env/bin/activate |
Relocate the environment (optional):
If necessary, you can use conda-pack to fix any
hardcoded prefixes from the source computer.
1 | conda-unpack |