Last updated: Apr 11, 2024
Reading time·3 min
The Conda "PackagesNotFoundError: The following packages are not available from current channels" occurs when some of the packages you're trying to install are not available in your current Conda channels.
To solve the error, add the conda-forge
channel by issuing the
conda config
command.
Here is the complete error message:
Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve.PackagesNotFoundError: The following packages are not available from current channels: To search for alternate channels that may provide the conda package you're looking for, navigate tohttps://anaconda.organd use the search bar at the top of the page.
Open your terminal and run the following command.
conda config --append channels conda-forge
The conda config --append
command adds the specified channel to the bottom of
the channel list and makes it the lowest priority.
The next time you run the conda install
command, conda will also look for the
given package in the conda-forge
channel.
conda install requests
Conda channels are servers that store packages.
These servers host and manage packages.
When you conda install
a package, it gets downloaded from a remote channel.
Some of the channels might not store the packages you're trying to install.
If the error persists, you can try to install the package using pip
.
pip install requests # Or with pip3 pip3 install requests
You can use the conda list
command to list the installed packages in your
conda
environment.
conda list
The command will show the names of the packages and the installed version.
If the error persists, try to restore the free Conda channels.
Open your terminal and issue the following command.
conda config --set restore_free_channel true
After you run the command, try to rerun your conda install
command.
conda install requests
The conda config --append
command can be used to append a channel to your list
of channels.
conda config --append channels conda-forge
However, you can also explicitly set the channel when installing a module.
conda install -c conda-forge requests
Make sure to replace requests
with the name of the package you're trying to
install.
You can also try to specify multiple channels.
conda install requests -c defaults -c conda-forge -c pytorch
The command installs the requests
module using the defaults
, conda-forge
or pytorch
channels.
requirements.txt
file with multiple channelsIf you got the error when trying to install the packages from your
requirements.txt
file, run the following command.
conda install -y --file requirements.txt -c defaults -c conda-forge -c pytorch
You can add as many channels as necessary by using the -c
parameter.
pip install
command insteadIf the error persists, try to use the pip install
command.
pip install requests # Or with pip3 pip3 install requests
When installing a module in a Jupyter Notebook cell, prefix the command with an exclamation mark.
If the error persists, try to add the package you are trying to install as a channel.
For example, if you were trying to install keras
, you would run the following
command.
conda config — append channels keras
Then run the installation command.
conda install keras
If the error persists, try to update Anaconda.
The following command updates all packages in the current environment to the latest version.
conda update --all
Try to rerun your installation command after updating Anaconda.
conda install requests
You can also try to run the following command.
conda update conda
You can learn more about the related topics by checking out the following tutorials: