All programmers know the importance of Python as it is the core of programming. Anaconda is a package manager that contains a wide range of open-source packages for Python. When working with python along with having an anaconda package, an error pop up that is quite common. You can get ‘packagesnotfounderror: the following packages are not available from current channels:’.
No matter how long the error you get in the end after compiling your code, there are always some fixes that can handle the exception. When you are coding, this is something how the error happens
How does the error happen?
When you are trying to install new packages to access new functions for any new project, then it may through an exception like this
(base) C:\Anaconda2\Jupyter>conda install -c python-control -c cyclus slycot control
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- slycot
- control
Current channels:
- https://conda.anaconda.org/python-control/win-64
- https://conda.anaconda.org/python-control/noarch
- https://conda.anaconda.org/cyclus/win-64
...
That’s how you get the error. It’s frustrating when you have to stop coding your program as soon as you get an unexpected error.
Let’s check out the solution to resolve the issue
Solutions to Handle ‘packagesnotfounderror: the following packages are not available from current channels:’?
There are a few simplest ways to remove the error warning from your programming.
Add conda-forge
The main reason of ending up with the error warning is because no conda-forge is added to the list of channels. You can simply add
pip install <package>
or you can add
conda install -c conda-forge <package>
This conda-forge solution works really well.
Update the channel
Sometimes, the issue that seems complex can be resolved with a minor code just like updating the channel. Take a look at the code that can fix the issue
conda update --all
Its is this much simpler, you may just need this code to just give the channel a boost to keep functioning the way you want.
Check the packages installed
To address the issue in a proper way, you need to know the available packages along with the version. And to get this information, you need the following code
conda list
when running this code, you will get the desired information in return like this
Output
scikit-learn 0.19.1 py36hedc7406_0
Avoid pip command when using an anaconda or miniconda
To get rid of the error warning, you need to avoid the pip command when you are using Miniconda or Anaconda.
You need to use
!conda update conda
Instead of
!pip install -U scikit-learn
You will get to install the packages you want, but at the time of importing, the package will not work. So don’t use pip.
Conclusion
We have addressed the error ‘packagesnotfounderror: the following packages are not available from current channels:’. Different ways are discussed that can be followed according to the packages you want to have.
With that note. I wish you luck!
Happy Coding!
Reference Source: https://discourse.mozilla.org/t/anaconda-packages-are-not-available-from-current-channels/52181/10