Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Install conda packages with --override-channels #103

@maximlt

Description

@maximlt

I've been adding variations of these commands in many parts of the CI, pretty much every time a conflict appeared using this pattern fixed it:

          conda create -n test-environment
          conda activate test-environment
          conda config --env --append channels pyviz/label/dev --append channels conda-forge
          conda config --env --remove channels defaults
          conda install python=3.8 pyctdev
          doit develop_install ...

The idea was to:

  1. create an empty environment
  2. set the channels of that specific environment with conda config --env ...
  3. install the packages without having to define the channels with -c channel1 -c channel2 ...

It seemed like a nice approach that could have been codified in pyctdev to apply it across the repos. Its advantage would be that as a user of that created environment, locally, if you wanted to install something in that environment you wouldn't have to remember what channels it uses and in which order, as the channels are declared for you. However it has two limitations, mostly coming from conda:

  • tricky to configure(?): conda config has no -n option so it needs to be executed from an activated environment, I believe that running conda activate programmatically has some issues
  • no separation with the global config: the channels declared in the global ~/.condarc file still leak to the environments. For instance, if the global ~/.condarc file list the defaults channel, it is going to be available in the environment.

Instead of going down that route, I suggest that all the conda create/install commands executed by pyctdev:

  • take the whole list of channels
  • use --override-channels

I think that approach would be equivalent for conda to what I was doing above. As a user of that created environment, if you want to change the environment, you'll have to remember the whole list of channels and to use --override-channels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions