Using conda pack to Clone a Anaconda Python Environment Offline – Python Tutorial

By | November 3, 2023

Generally, we can use conda create –clone command to clone an existing anaconda environment. Here is the tutorial:

Conda Rename Python Environment: A Beginner’s Guide – Anaconda Tutorial

However, this method needs your computer is online, if you are offline, this method will not work.

How to clone an existing anaconda environment offline?

We can use conda pack tool and these are some steps.

Step 1: install conda pack

We can use pip to install.

 pip install conda-pack

Step 2: pack an existing anaconda environment

For example:

conda pack -n my_env -o out_name.tar.gz

my_env is an existing anaconda environment offline and we will pack it to out_name.tar.gz

You should notice: you should pack my_env  environment in base environment, not in my_env environment.

Step 3: unpack out_name.tar.gz

Then, you can unpack out_name.tar.gz. You will find new environment exist.

You can use conda env list to check.