Issue
If I specify channels:
in my env.yml
file, the packages used for the env creation are indeed from this channel.
$ cat env.yml
channels:
- conda-forge
- nodefaults
dependencies:
- python=3.8
- numpy
Create env:
$ conda env create -n test -f env.yml
$ conda activate test
The packages are installed though the correct channel:
$ conda list
# packages in environment at /home/mathurin/anaconda3/envs/test:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 1_gnu conda-forge
But when, inside this env, I later install other packages, they are still from the defaults channels:
$ conda config --show channels
channels:
- defaults
How can I tell conda to set, once and for all, the channels to something for this env, and can it be done inside the environement.yml
?
Solution
This isn't possible through a YAML. However, one can set environment-specific configuration settings.
conda activate test
conda config --env --append channels conda-forge --append channels nodefaults
The key this is the --env
argument: This edits a .condarc
in the envs/test/
directory, which will take precedence over any system- or user-level .condarc
. However, both .condarc
files will be loaded, so if you explicitly have defaults
in your ~/.condarc
, it will still show up after the environment-specific ones.
Answered By - merv
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.