1

I'm trying to clone a conda environment. I tried conda list --export and then tried restoring into a new environment.

However, there were a lot of packages ending with =pypi that could not be found in conda's repository.

Where do these =pypi packages come from?

Att Righ
  • 1,439
  • 1
  • 16
  • 29

1 Answers1

0

According to Anaconda's Managing Environments webpage, you can create a yml file and then create a new environment by using this yml file. The advantage being that "this file handles both the environment's pip packages and conda packages."

So firstly you create the yml file from the environment you want to clone (I'm using Windows PowerShell as an example of the expected output in the terminal):

(base) C:\Users\user> conda activate envIWantToClone
(envIWantToClone) C:\Users\user> conda env export > myEnv.yml

This yml file will be in the directory of the terminal, i.e. C:\Users\user. Then you have to edit the first line of the file, changing the name of the environment from envIWantToClone to clonedEnv, for example:

# name: envIWantToClone  # CHANGE THIS TO clonedEnv
name: clonedEnv
channels:
 - defaults
 - cona-forge
dependencies:
...

Then back in the terminal (which environment is currently active does not matter at this point):

(envIWantToClone) C:\Users\user> conda env create -f environment.yml

Then check if everything is working correctly

(envIWantToClone) C:\Users\user> conda activate clonedEnv
(clonedEnv) C:\Users\user> |
Breno
  • 748
  • 8
  • 18