How do I export a conda environment? (command seems not to be working)

Question:

I would like to export a conda environment, so that I can use it on another PC. I found this:
https://docs.anaconda.com/anaconda-cloud/user-guide/tasks/work-with-environments/

And used the command that is in there, in the command promt opened via the anaconda navigator as follows: conda env export --name root -f root.yml. No feedback was given, and the root.yml file seems nowhere to be found.

After looking on stackoverflow, I found the command conda env export > root.yml. However, still no feedback is given, and the root.yml file is also missing. Running only conda env export gives a list of the name, channels, dependencies, and prefix. However, still no yml file to export.

I have the following versions:

 conda version : 4.7.12
    conda-build version : 3.18.8
         python version : 3.7.3.final.0

Can anyone tell me what I am doing wrong?

Answers:

Try using this command:

conda list --name root --export > root-env.txt

This is one of the recommended methods for saving an environment spec. List the contents in a known format that conda can reuse (the --export flag) and then write to a file using the > operator.

The exported file will be in whatever directory you are running the command from. I.e. running:

C:Usershello>conda list --name root --export > root-env.txt

Will save the file to

C:Usershelloroot-env.txt
Answered By: James

Although this is an old question & answer, I also just faced the same problem recently. I post my experience in case it helps others currently facing this issue.

When using the command:

conda env export --from-history

(or any option following conda env) I would get only a [y/N]: in the output and no response.

I found that upgrading conda from 4.13.0 to 4.14.0 (in that environment) solved my issue.

conda update conda
Answered By: stephinity
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.