feature request: save environments with only user requested packages and not their dependencies #546

electronwill opened this Issue Nov 19, 2015 · 3 comments


None yet

3 participants


New feature request: It would be nice to be able to save an environment with only its user requested packages and without also listing their dependencies. This would lead to simpler environment files which are easier to read and edit, and would also often make the environment file more portable across platforms. The information in '$PREFIX/conda-meta/history' might suffice, or conda might need to tag each package with a boolean variable indicating whether it was requested by a user or installed as a dependency of a package requested by a user.

jni commented Nov 19, 2015

Thanks for this report!

@dwyatte dwyatte referenced this issue in conda/conda Mar 18, 2016

Cross-platform requirements files #1033

robintw commented Jun 7, 2016

Has there been any progress with this?

And, if not, what is the current recommended best-practice? Manually maintaining a separate environment.yml file for each platform?

electronwill commented Jun 8, 2016 edited

I've contacted the devs about a way to use conda to create a "request list" with only the packages that a user requested, and not the packages that were pulled in as dependencies of those. I'll reply here and at conda issue 1033 sometime this week when they get back to me.

Without a request list, you could either have an automatically generated file for each platform, or one hand edited file for all platforms. I usually use an automatically generated file for each platform, because it's quite fast and easy to generate without hand editing, it's more specific, and it makes the results a little more reproducible, but in some cases the convenience of using a single file for all platforms may outweigh that.

A request list will only be helpful for some environments. For any environment, we can ask if all its user requested packages are cross platform, and if all its other packages are cross platform. The answers to these two questions divide environments into four categories: no/no, no/yes, yes/no, and yes/yes. A request list would help in the yes/no category but not the other three.

Here's an example of a hand edited file. On OS X I ran:

conda create -n env1 scipy
source activate env1
conda env export > environment.yml

This was the output:

name: env1
- mkl=11.3.3=0
- numpy=1.11.0=py35_1
- openssl=1.0.2h=1
- pip=8.1.2=py35_0
- python=3.5.1=0
- readline=6.2=2
- scipy=0.17.1=np111py35_0
- setuptools=22.0.5=py35_0
- sqlite=3.13.0=0
- tk=8.5.18=0
- wheel=0.29.0=py35_0
- xz=5.0.5=1
- zlib=1.2.8=3

I simplified it to this environment.yml file:

name: env1
- scipy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment