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
.
You can use Anaconda to export a Python virtual environment to a YAML file you can then reuse in different projects. You can also share the YAML file with your team, so everyone's on the same track.
Go to the start menu, right-click 'Anaconda Prompt' and go to file location. Open its properties & change the target to the location of your preferred environment.
I stumbled across the same problem and wrote a small parser for exactly this problem. In your case, you could create an environment.yml.meta file as follows:
name: demo_env
dependencies:
- <your_other_dependencies>
- libgfortran [platform startswith linux]
- openssl [platform startswith linux]
and then create the environment from it with
python create_env.py
It's of course not the same as if it was supported native, because you need to either add the parser as submodule to your repo or just copy it over, but maybe you find it useful. The project is on GitHub:
https://github.com/silvanmelchior/cme_parser
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With