Migrate the conda environment to another server

  • Install conda-pack this package
pip install conda-pack
  • packaging environment
conda pack -n my_env

my_env is the name of the environment you want to package

Executing this command will generate a compressed file my_env.tar.gz in your current path

  • Transfer the compressed file to your other computer

Here you can use scp command transmission, or other software transmission

For example, I transfer the semi.tar.gz compressed file in the current directory to another server (the user name is wzc and the ip address is 172.17.161.221) under /home/wzc

scp -r semi.tar.gz [email protected]:/home/wzc

operation result

After the transfer is complete, on another server, it can be found that semi.tar.gz already exists in /home/wzc

(Here I just renamed the compressed file)

 

  •  Find the path of the anaconda storage environment of the current server, and unzip the file to the path

1. Under the path where anaconda stores the environment , create a new folder, and the file name is the name of the environment you want

For example, I create a semidg folder

 Note that you must create this folder in anaconda's envs

Attachment: The anaconda paths installed on different machines are not the same, you can enter

conda info -e

View all your environments and the path where the environment is located

As shown in the figure below, you need to enter the /home/wzc/anaconda3/envs folder to create a new folder

2. Unzip the compressed file into this folder

tar -xzf semidg.tar.gz -C ~/anaconda3/envs/semidg

Do this, we will migrate the environment to another server

Whether the test was successful

can enter

conda activate 你的环境名

If the activation environment is successful, it means success!

Precautions:

1. The conda environment on linux cannot be transplanted to windows

Guess you like

Origin blog.csdn.net/Wjeana/article/details/126705655