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) ?
Solution 1:
Update conda to version 4.2.12 (was 4.1 in my case)
conda update conda
then create environment by loading the requirements file
conda env create -f requirements.yml
Solution 2:
Add the name of the channels in the channels
section of the file and remove the channel name in the package list:
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