Anaconda: Can You Simply Copy an Installation / Environment Folder?
Asked Answered
T

3

6

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'?

Thai answered 17/10, 2018 at 17:3 Comment(2)
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 tabShibboleth
Might be worth checking out conda-pack. Never used it, but it's supposedly for packaging relocatable envs.Daisydaitzman
E
2

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/

Empirin answered 17/10, 2019 at 14:14 Comment(0)
A
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
Ashcan answered 17/10, 2018 at 18:1 Comment(3)
Exporting doesn't work in my experience. You get errors while importing / creating due to package changes and updates.Thai
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.Ashcan
Excellent Idea, but it does not work while your target environment has absolutely no internet access where you have to pack the environment yourselfKharkov
B
0

According to https://docs.anaconda.com/working-with-conda/reference/faq/, after you paste the folder, you can try

source <path to conda>/bin/activate

e.g. source ~/anaconda3/bin/activate, which initialises the folder into an anaconda installation.

Also, I tried this on Linux, and it worked. Not sure about Windows.

Booking answered 15/8 at 5:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.