3

I'm trying to create an environment with miniconda by using a requirements.yml file generated from another conda environment. I have troubles with packages that are coming from channels.

On a machine the requirements.yml is generated from an existing environment with the following command:

(myenv)$ conda env export > requirements.yml

The contents of the requirements.yml file are (after cleaning version numbers):

name: myenv
channels: !!python/tuple
- !!python/unicode
 'defaults'
dependencies:
- pytest
- conda-forge::pytest-xdist
- pytest-cov
- numpy
- scipy
- pymongo
- auto::pycallgraph
- flask
- conda-forge::flask-restful
- conda-forge::flask-httpauth
- blaze::flask-mongoengine
- hugo::flask-security
- flask-wtf
- wtforms
- conda-forge::mongoengine
- pip:
 - descartes
prefix: .miniconda2/envs/myenv

The above packages have been installed "manually" by specifying the channel, e.g.,

$(myenv) conda install -c conda-forge pytest-xdist

Transferring the requirements.yml to another machine (same architecture, linux-64), conda fails in creating a new environment:

$ conda env create --file requirements.yml

Fetching package metadata .......
Solving package specifications: .
Error: Packages missing in current linux-64 channels: 
  - conda-forge::pytest-xdist
  - auto::pycallgraph
  - conda-forge::flask-restful
  - conda-forge::flask-httpauth
  - blaze::flask-mongoengine
  - hugo::flask-security
  - conda-forge::mongoengine

It seems that conda cannot parse the syntax <channel>::<package name>.

System used: docker image continuumio/miniconda.

Do you have any ideas how to nicely create a new environment from a specification file (e.g., useful for continuous integration) ?

4

1 回答 1

3

解决方案1:

将 conda 更新到 4.2.12 版本(在我的情况下是 4.1)

conda update conda

然后通过加载需求文件创建环境

conda env create -f requirements.yml

解决方案2:

在文件部分添加channels频道名称并在包列表中删除频道名称:

name: myenv
channels: !!python/tuple
- !!python/unicode
  'defaults'
- !!python/unicode
  'auto'
- !!python/unicode
  'conda-forge'
- !!python/unicode
  'blaze'
- !!python/unicode
  'hugo'
dependencies:
- pytest
- pytest-xdist
- pytest-cov
- numpy
- scipy
- pymongo
- pycallgraph
- flask
- flask-restful
- flask-httpauth
- flask-mongoengine
- flask-security
- flask-wtf
- wtforms
- mongoengine
- pip:
 - descartes
prefix: .miniconda2/envs/myenv
于 2016-11-17T14:59:02.150 回答