eric
eric

Reputation: 8029

conda export is not saving any dependencies

I'm trying to save my conda environment so I can send it to others to reproduce my work. Within my activated environment:

(env_name) c:\eric\ conda env export > environment.yml

This environment has dozens of packages installed (including numpy, matplotlib). When I open the resulting environment.yml file, I get only:

name: env_name
channels:
  - conda-forge
  - defaults
prefix: C:\Users\eric\Miniconda3\envs\env_name\envs\env_name

That is the entire file: there isn't even a line for dependencies: that shows up, which usually does show up for the packages in the env.

I am using miniconda, version 4.12.0, and have run conda update conda.

Conda issues

I found two issues at conda that have come up with this:

One solution at the first issue is to use the following command:

conda env export -p path-to-folder > environment.yml

Unfortunately this did not work for me, but it seems to have worked for many.

Comparison to related question

Note indeed the prefix value is pretty strange it typically is something like:

C:\Users\eric\.conda\envs\env_name

Frankly I am not concerned about that, unlike the related question focused on removing that prefix and the accepted answer does that bash shell commands: Anaconda export Environment file.

My question is more first-order: why aren't dependencies showing up in my yaml file?

e.g., something like the following should be appearing:

dependencies:
  - pandas=1.0.3=py37h47e9c7a_0
  - qt=5.9.7=vc14h73c81de_0
  - pip:
    - imageio==2.9.0
    - scikit-image==0.17.2

But literally there are zero dependencies, and not even a dependencies argument.

Upvotes: 3

Views: 1428

Answers (1)

merv
merv

Reputation: 76750

It's possible the environment isn't properly activated and therefore it's not actually exporting what is wanted. Fortunately, most Conda commands provide arguments to specify an environment explicitly. Specifically, try using the --name,-n argument, like

conda env export -n env_name > env_name.yaml

Personally, I try to always use an --name,-n or --prefix,-p flag, because I find context-sensitive commands are more prone to errors (e.g., installing in incorrect environments).

Upvotes: 2

Related Questions