Search code examples
pythoncross-platformconda

Is there a way to have platform-specific dependencies in environment.yml?


I'm trying to use Conda to set up build & testing environments for a project (LensKit), and need to have platform-specific dependencies. Specifically, on Linux builds I need libgfortran and openssl, but not on Windows.

Is there a way that I can state, in environment.yml, that I need libgfortran but only on the 32- and 64-bit Linux platforms? Or do I need to have separate environment definitions to cover this case?

The other potential solution I see is creating a dummy package and publishing it to http://anaconda.org that just depends on the required base packages for each platform, and require that package in environment.yml.


Solution

  • The "dummy packages" are actually called "metapackages". See https://docs.conda.io/projects/conda-build/en/latest/resources/commands/conda-metapackage.html. That seems a good option.

    Alternatively, could you build a conda package of your project? In the conda recipe's meta.yml you can use selectors for different platforms. https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#preprocessing-selectors