Default channels packages to conda-forge packages

"Our organization aims to transition from the default (we are using miniconda) channel to conda-forge. Our existing images utilize packages installed from the default channel via the repo.anaconda URL. To facilitate this transition, we’ve decided to migrate all packages installed from the default channel to conda-forge. Is there a way to accomplish this?

Build your images from miniforge3 and that’s pretty much it. If you are missing some packages in conda-forge, then you can contribute the recipes through conda-forge/staged-recipes.

Hi @jaimergp ,

Thanks for the response.

We are using existing images in our production environment that utilize Anaconda packages. We want to replace these with packages from the conda-forge channel. How can we achieve this?

FYI,We are using multiple images with different versions of python. 3.8,3.9,3.11 and 3.12

It’s unclear to me whether you are using the Miniconda base images, or installing the Miniconda app on top of your image.

For (1), change the base image to something offered by GitHub - conda-forge/miniforge-images: Container images that include conda-forge's miniforge setup
For (2), change the installer URL from Miniconda to Miniforge

If none of the above applies, make sure to add a .condarc file in $HOME with channels: [conda-forge] and that should do it (but your base env might still have packages from defaults).

Thank you for your response.

We are using Ubuntu as our base image and installing Miniconda on it. For newer images, we can replace Miniconda with Miniforge and Micromamba.

For the existing images, we can remediate using conda-forge channels. However, we need to handle packages that are already installed from different channels, which is why we are struggling.

You’ll have to delete the environments, clean the cache, make sure defaults is not in the conda config --show-sources output, and then recreate the environments.

For your base environment, you’d need to reinstall with Miniforge, or do some surgery (this might break everything and you need a reinstall anyway):

  1. Clear your (path to base env)/conda-meta/history file. It should exist but empty.
  2. Run conda update --all --override-channels -c conda-forge -n base
  3. Cross your fingers.
  4. If it worked, conda clean --all to clear the cache.

Thank you for your response.

We have already tried using two images with the same method, and they are working fine. However, the older container hangs because Python, Conda, and other dependencies were downloaded through the default channels.

I appreciate your assistance once again.