Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branch or Fork a Conda Environment

Tags:

conda

I would like to copy a conda environment under a different name.

I have a conda environment that I like. I would like to create a new environment with a copy so that I can make some experimental edits. In git parlance I'm looking for branch or checkout -b.

  • Does such a branch or fork feature exist in conda?

  • If not what is the best workaround today?

like image 551
MRocklin Avatar asked Sep 28 '16 11:09

MRocklin


People also ask

How do I create an environment in conda?

Create the environment from the environment.yml file: conda env create -f environment.yml The first line of the yml file sets the new environment's name. For details see Creating an environment file manually.

What does the conda activate base setting do?

This setting controls whether or not conda activates your base environment when it first starts up. You'll have the conda command available either way, but without activating the environment, none of the other programs in the environment will be available until the environment is activated with conda activate base.

What is Conda in Python?

Conda is a package manager and a virtual environment and it provides the convenience of allowing you to manage what version of Python the virtual environment (and as a result your project) uses as well. So naturally, conda is very convenient and I use it my projects as well. How to use conda environment?

What is Conda environment in NumPy?

Conda environments ¶ A conda environment is a directory that contains a specific collection of conda packages that you have installed. For example, you may have one environment with NumPy 1.7 and its dependencies, and another environment with NumPy 1.6 for legacy testing. If you change one environment, your other environments are not affected.


2 Answers

the above (export|create) information still works, but is out of date now, conda now has a CLONE option:

conda create --clone <existing enviroment> -n <new environment>
like image 105
DarenR Avatar answered Oct 10 '22 11:10

DarenR


You can create a copy of the environment by using conda env export > environment.yml on all platforms and then activate that env with conda env create -f environment.yml. Make your desired changes and when you want to revert then activate your orginal environment.

like image 21
rakesh Avatar answered Oct 10 '22 11:10

rakesh