I built a conda environment using these steps:
conda create -n torch-cuda conda activate torch-cuda conda install pytorch=2.1.0=py3.11_cuda11.8_cudnn8.7.0_0 pytorch-cuda=11.8 -c pytorch -c nvidia conda config --set channel_priority disabled conda install h5py jupyter matplotlib pandas -c conda-forge
So, packages are being installed from 4 different channels: default, conda-forge, nvidia, and pytorch as confirmed by running
However, when I run
conda env export --from-history > ENV.yml
This is what I get:
name: torch-cuda channels: - defaults dependencies: - pytorch-cuda=11.8 - pytorch==2.1.0=py3.11_cuda11.8_cudnn8.7.0_0 - h5py - jupyter - matplotlib - pandas prefix: /lusr/opt/miniconda/user-envs/pgoetz/torch-cuda
I mean, yes, it is only listing packages that I explicitly installed, but I don’t see any way that someone could recreate the environment from this yaml file, because, for example, the version of pytorch installed here is only available through the pytorch channel, which isn’t mentioned in the environment file. Moreover, h5py, jupyter, matplotlib, and pandas are all being installed from the conda-forge channel, also not mentioned.
The alternative way to export an environment:
conda env export > ENV2.yaml
creates a file which does list all the channels used, followed by an overwhelming list of (290) installed packages. Surely there is a middle ground here? I’m 100% not following why the –from-history option causes the channels used to not be referenced in the yaml output file, since without this it’s an incomplete resource.