How to share conda environments across platforms

This answer is given with the assumption that you would like to make sure that
the same versions of the packages that you generally care about are on
different platforms and that you don’t care about the exact same versions of
all packages in the entire dependency tree. If you are trying to install the
exact same version of all packages in your entire dependency tree that has a
high likelihood of failure since some conda packages have different
dependencies for osx/win/linux. For example, the recipe for
otrobopt

will install different packages on Win vs. osx/linux, so the environment list
would be different.

Recommendation: manually create an environment.yaml file and specify or pin
only the dependencies that you care about.
Let the conda solver do the rest.
Probably worth noting is that conda-env (the tool that you use to manage conda
environments) explicitly recommends that you “Always create your
environment.yml file by hand.”

Then you would just do conda env create --file environment.yml

Have a look at the readme for
conda-env.

They can be quite simple:

name: basic_analysis
dependencies:
  - numpy
  - pandas

Or more complex where you pin dependencies and specify anaconda.org channels to
install from:

name: stats-web
channels:
  - javascript
dependencies:
  - python=3.4   # or 2.7 if you are feeling nostalgic
  - bokeh=0.9.2
  - numpy=1.9
  - nodejs=0.10
  - flask
  - pip:
    - Flask-Testing

In either case, you can create an environment with conda env create --file environment.yaml.

NOTE: You may need to use .* as a version suffix if you’re using an older version of conda.

Leave a Comment