5

Reinstalling environments is a huge hassle, I find that exporting and importing doesn't work and you have to manually figure out how to get newer packages to install and work together, so you must keep a log of installation history.

Can I just save the 'Anaconda2' or 'Anaconda3' folder and paste it into a new windows installation? What about 'Anaconda2\envs' or 'Anaconda3\envs'?

user1581390
  • 1,900
  • 5
  • 25
  • 38
  • In the Anaconda Navigator there is an option to copy or duplicate (I forget the exact term and not at PC) when you select a non-base environment in the Environment tab – roganjosh Oct 17 '18 at 17:25
  • Might be worth checking out [conda-pack](https://github.com/conda/conda-pack). Never used it, but it's supposedly for packaging relocatable envs. – merv Mar 17 '19 at 02:40

2 Answers2

1

Create a conda environment

conda create --name python=

To create a requirements.txt file:

conda list #Gives you list of packages used for the environment

conda list -e > requirements.txt #Save all the info about packages to your folder

To export environment file

activate conda env export > .yml

For other person to use the environment

conda env create -f <environment-name>.yml
Meghdeep Ray
  • 5,262
  • 4
  • 34
  • 58
  • Exporting doesn't work in my experience. You get errors while importing / creating due to package changes and updates. – user1581390 Oct 18 '18 at 03:16
  • 1
    In that case you need to specify the exact error because this is the official method of exporting a conda environment as per the documentation. – Meghdeep Ray Oct 18 '18 at 06:22
  • 1
    Excellent Idea, but it does not work while your target environment has absolutely no internet access where you have to pack the environment yourself – runzhi xiao Nov 29 '21 at 08:04
1

I was just googling around this same questions. It appears the answer is no, but I haven't actually tried it. That would be the best way to know for sure.

https://docs.anaconda.com/anaconda/user-guide/tasks/move-directory/

Rich C
  • 3,164
  • 6
  • 26
  • 37