python - How to share conda environments across platforms -


the conda docs @ http://conda.pydata.org/docs/using/envs.html explain how share environments other people.

however, docs tell not cross platform:

note: these explicit spec files not cross platform, ,       therefore have comment @ top such # platform: osx-64 showing   platform created. platform 1 spec file known work. on other platforms, packages specified might not available or dependencies might missing of key packages in spec.  note: conda not check architecture or dependencies when installing  explicit specification file. ensure packages work correctly, sure file created working environment ,  used on same architecture, operating system , platform, such linux- 64 or osx-64. 

is there method share , recreate conda environment in 1 platform (e.g. centos) in platform (e.g. windows)?

answer

this answer given assumption make sure same versions of packages care on different platforms , don't care exact same versions of packages in entire dependency tree. if trying install exact same version of packages in entire dependency tree has high likelihood of failure since conda packages have different dependencies osx/win/linux. example, the recipe otrobopt install different packages on win vs osx/linux, environment list different.

recommendation: manually create environment.yaml file , specify or pin dependencies care about. let conda solver rest. worth noting conda-env (the tool use manage conda environments) explicitly recommends "always create environment.yml file hand."

then conda env create --file environment.yml

have @ readme conda-env.

they can quite simple:

name: basic_analysis dependencies:   - numpy   - pandas 

or more complex pin dependencies , specify anaconda.org channels install from:

name: stats-web channels:   - javascript dependencies:   - python=3.4   # or 2.7 if feeling nostalgic   - bokeh=0.9.2   - numpy=1.9.*   - nodejs=0.10.*   - flask   - pip:     - flask-testing 

in either case, can create environment conda env create --file environment.yaml

if have more complex use case or further questions, update original question , i'll see if can't bit more.


Comments