Remote solution for Conda environment porting (clone)

Students who do scientific computing may sometimes use Anaconda, especially when configuring the environment on a new server, which is very fast and effective.

Then the problem comes, sometimes we will encounter such a scenario.

I have already configured a set of my conda environment on the A server, but now I have a few more servers. I want to configure the same, and I don't want to reinstall it one by one. Can the conda environment be transplanted directly to a new computer?

The answer is definitely yes. It's just that basically no one mentioned this thing on the Chinese website information.

There is a porting option in the conda command itself.
If the premise is that there is already an AAA environment in the local conda, and I want to create a new environment called BBB exactly like it, then this sentence will do it:

conda create -n BBB --clone AAA

But what if it's across computers.

Actually it's the same.

The original description of the query conda create command is as follows:

–clone ENV
Path to (or name of) existing local environment.

The --clone parameter can be followed by not only the name of the environment, but also the path to the environment.

So, naturally, we can copy the directory of the target conda environment on the original computer to the new computer, and then use:

conda create -n BBB --clone ~/path

All the packages are installed directly in one step, and the migration of the environment is completed.
The address of the environment on the original computer can be
conda info -equeried with .

But pay attention to a small problem :
the transplanted environment only installs the packages that were installed directly by commands such as conda install in your original environment. The things you installed with pip and the like have not been transplanted, and you need to reinstall them.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325918588&siteId=291194637