Summary: To ensure that data scientists can reproduce each other’s conda environments exactly, conda now has the ability to use explicit specification files which list the exact local or remote URL from which to download and install each package.

Summary: To ensure that data scientists can reproduce each other’s conda environments exactly, conda now has the ability to use explicit specification files which list the exact local or remote URL from which to download and install each package.

Once data scientists have their code working in a conda environment with the needed dependencies installed, they often wish to share the code and the environment so others can understand, reproduce, verify, and extend their work.

You can do this by exporting your active environment to a specification file:

conda list -e > spec-file.txt

 

You can then share or publish the specification file. Here is a typical example:

# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
astropy=1.0.4=np19py27_0
ncurses=5.9=1
numpy=1.9.2=py27_0
openssl=1.0.1k=1
pandas=0.16.2=np19py27_0
pip=7.1.2=py27_0
python=2.7.10=0
python-dateutil=2.4.2=py27_0
pytz=2015.4=py27_0
readline=6.2.5=1
setuptools=18.1=py27_0
six=1.9.0=py27_0
sqlite=3.8.4.1=1
tk=8.5.18=0
wheel=0.24.0=py27_0
zlib=1.2.8=1

 

As the comment in the file says, anyone using a computer or a virtual machine with the same processor architecture and operating system platform can create their own identical copy of the environment from the file:

conda create --name MyEnvironment --file spec-file.txt

 

However, the specification files simply list the names and versions of each package in the environment, and not which channels to search for those packages. Some of the scientists who receive the file may have overridden the defaults and set their machines to search different channels, which could create differences in their environments. To prevent this, in version 3.18.2 conda introduced explicit specification files, which list the exact local or remote URL from which to download and install each package.

With the explicit option, you can export the full details of your environment, including URLs:

conda list --explicit > explicit-spec-file.txt
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
@EXPLICIT
https://repo.continuum.io/pkgs/free/osx-64/astropy-1.0.4-np19py27_0.tar.bz2
https://conda.anaconda.org/asmeurer/osx-64/ncurses-5.9-1.tar.bz2
# no URL for: numpy-1.9.2-py27_0
# no URL for: openssl-1.0.1k-1
# no URL for: pandas-0.16.2-np19py27_0
https://repo.continuum.io/pkgs/free/osx-64/pip-7.1.2-py27_0.tar.bz2
# no URL for: python-2.7.10-0
# no URL for: python-dateutil-2.4.2-py27_0
# no URL for: pytz-2015.4-py27_0
https://conda.anaconda.org/asmeurer/osx-64/readline-6.2.5-1.tar.bz2
https://repo.continuum.io/pkgs/free/osx-64/setuptools-18.1-py27_0.tar.bz2
# no URL for: six-1.9.0-py27_0
# no URL for: sqlite-3.8.4.1-1
# no URL for: tk-8.5.18-0
https://repo.continuum.io/pkgs/free/osx-64/wheel-0.24.0-py27_0.tar.bz2
https://conda.anaconda.org/asmeurer/osx-64/zlib-1.2.8-1.tar.bz2

 

As the comment says, anyone on that platform can create an identical environment from that file:

conda create --name MyEnvironment --file explicit-spec-file.txt

 

Some packages say “no URL”, because conda found them in the local copy of Anaconda itself and did not need to fetch them from any URL.

Local file URLs are supported, as well as https.

We hope this new option will make it easier and safer for everyone to share their data and work together than ever before. Happy computing!

If you do not yet have Anaconda, download Anaconda now.


About the Author

Will is a documentation and software tester and technical writer who enjoys hiking, reading, and science fiction, and looks forward to seeing how larger data sets, more powerful computers, and better tools for working with them will transfo …

Read more

Join the Disucssion