Error Description
When creating a new environment, you might encounter the following error:
Channels:
- defaults
- conda-forge
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python-3.8
Current channels:
- defaults
- https://conda.anaconda.org/conda-forge
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
Solution Steps
Reconfigure the conda-forge channel for the current user:
conda config --add channels conda-forge
conda config --set channel_priority strict
Then recreate your environment:
conda create -n my-project-env python=3.8 -y
Technical Explanation
Adding conda-forge Channel
The command conda config --add channels conda-forge adds the community-maintained conda-forge repository to your configuration. This channel provides extensive package coverage, including many packages not available in the default channels.
Setting Strict Channel Priority
The command conda config --set channel_priority strict enforces a hierarchical search order where packages from higher-priority channels are preferred. This prevents version conflicts and ensures consistent package resolution.
Why This Configuration Works
The default channel configuration may not include conda-forge or may assign it insufficient priority. By adding conda-forge and enforcing strict priority, conda searches this comprehensive repository first for required packages like python-3.8. This expanded search scope combined with prioritized resolution successfully locates the missing packages that were unavailable in the original configuration.