A1122
A1122

Reputation: 1354

conda --from-history and --no-build doesn't work together

I want to remove the build id when I'm creating environment.yml but also generate the file from history so there are less packages. However

 conda env export --no-build --from-history > environment.yml

still returns the build id for each package. Is there another way?

I am on latest 4.9.2 conda.

Upvotes: 2

Views: 1875

Answers (1)

merv
merv

Reputation: 76750

As of Conda v4.9, no, the two flags do not work together. The --from-history flag will trigger only the explicit specifications being output, and those go down to whatever level of detail the user originally specified (can be versions, channels, builds, subdirs, etc.).

You may just need to strip it down after. E.g.,

conda env export --from-history | sed -E 's/(=[^=]+)=[^=]+$/\1/'

This should strip just the builds, but not the versions. However, it may miss some edge cases for the pip: section.

Alternatively, you may be interested in the related question, Export Conda Environment with minimized requirements, about exporting a minimized set of requirements (i.e., based on the dependency graph, rather than user history, which can still have redundancies).

Upvotes: 2

Related Questions