How do I control default channels with conda constructor when building from conda-forge?

170 Views Asked by At

I have a conda constructor process that creates an installer using only conda-forge packages (plus my own), but when I test it and use conda info, the default channels are all anaconda channels and conda-forge is not even included. This means that the usual conda commands like install and create will usually fail unless -c conda-forge is added.

Note that my construct.yaml does have lines

channels:
  - https://conda.anaconda.org/conda-forge

conda_default_channels:
  - https://conda.anaconda.org/conda-forge

where I'd think the latter should set the default channel, but this does not seem to be carried into the conda installation when the installer is run. FWIW, I do not have a ~/.condarc on either the build or install machines and the .condarc for the constructor location contains only:

channels:
  - conda-forge

I know that I can create a .condarc file in the package directory with contents:

channels:
 - conda-forge
 - defaults
channel_priority: true

(or even leave out the defaults line, since I really should not need anything from the anaconda channels), but this seems really clumsy. I'd think there should be a better way.

1

There are 1 best solutions below

0
On

Best as I can tell, the anaconda repo's are hard-coded into conda but use of the construct.yaml setting

write_condarc: True

causes a .condarc file to be written into the project's directory when installed, which overrides the channel.