pythonconda

How to package conda env into one single file?


There are anaconda, fully package conda env. and mini conda, with minium packagea.

Instead of exporting into yaml file or txt file, would like to export current env. into a bash executable sh file.

So, this file can be used to install env. for air gap environnments.


Solution

  • I'd look into using conda-pack: https://conda.github.io/conda-pack/

    It's used to ship a python environment in distributed environments like YARN, where a consistent Python environment is needed across many compute nodes.

    You'll develop your environment in a space where internet access is possible and install the conda-pack, then pack it up as an archive eg: conda pack -n my_env -o out_name.tar.gz, and deploy it from the archive. Once you've unzipped the archive you need to source an activate script and it should be good to go. this will look something like: source <env_directory>/bin/activate

    One thing it can't do is ship a windows environment to a Linux one and vice versa. see the docs linked for more details and caveats.