相关文章推荐
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm somewhat new to Python. I've used it in a bunch of projects, but haven't really needed to stray from its standard setup. I'm trying to install some new packages to get access to functions necessary for a university assignment. When I try to install, I get the following:

(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

And a bunch of other channels similar to that above.

I've been searching for a solution, but haven't found anything substantial. I've seen that it may be a problem with Windows, which is what I'm using it on. Past that I haven't a clue of what is going on.

Keep in mind, I don't really understand how channels and packages work, so any insight on that matter would be great too.

Note for anyone reading this: Don't use the base environment for all your projects, or at all, really. – AMC Feb 27, 2020 at 17:56 This may not directly answer the question thus adding this as comment. In may case I had the same error but my root cause was different , the package name in my requirement file was incorrect. It was "scikit_learn" but it was supposed to be "scikit_learn". Thus do verify the package name as well. – ManojKumar Jun 28, 2022 at 8:43

Try adding the conda-forge channel to your list of channels with this command:
conda config --append channels conda-forge. It tells conda to also look on the conda-forge channel when you search for packages. You can then simply install the two packages with conda install slycot control.

Channels are basically servers for people to host packages on and the community-driven conda-forge is usually a good place to start when packages are not available via the standard channels. I checked and both slycot and control seem to be available there.

I tried what you suggested and arrived at this: { Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - slycot Current channels: - repo.continuum.io/pkgs/main/win-64 - repo.continuum.io/pkgs/main/noarch } And more links with the conda-forge ones at the bottom. I've read on some forums that slycot is only supported for linux and OSX currently. Not sure the validity of those claims however. – Sunafegon Feb 1, 2018 at 0:29 Well, if the package is not supported by Windows, you're out of luck I fear. Only other thing that comes to mind is trying to install it via pip (pip install ...). This will install the package in your conda-directory but use Python's build-in package manager instead. Sometimes packages are only available via pip. – Max S. Feb 1, 2018 at 22:36 I had to add conda config --add channels loopbio to install gtk2 (github.com/loopbio/gtk2-feedstock) – ezChx Feb 6, 2018 at 16:31 It's generally a good idea to just conda config --append channels. This will put it at a lower priority than the standard channels and only looks there if the package is not found elsewhere. --add puts it on top of the channel list, so conda will install as many packages from the custom channel as possible... from my experience, this can get messy. – Max S. Feb 17, 2018 at 17:07 Worked perfectly. Run @MaxS solution before creating an environment and installing the requirements: conda create --name <env_name> --file <requirements.txt> – datalifenyc Feb 19, 2020 at 17:49 The command: conda install -c conda-forge <package> Has worked much better for me than: conda config --append channels conda-forge Which causes conda to go into an endless "Solving environment" loop. – algoquant Nov 28, 2020 at 0:54

Thanks, Max S. conda-forge worked for me as well.

scikit-learn on Anaconda-Jupyter Notebook.

Upgrading my scikit-learn from 0.19.1 to 0.19.2 in anaconda installed on Ubuntu on Google VM instance:

Run the following commands in the terminal:

First, check available the packages with versions

conda list    

It will show packages and their installed versions in the output:

scikit-learn              0.19.1           py36hedc7406_0  

Upgrade to 0.19.2 July 2018 release.

conda config --append channels conda-forge
conda install scikit-learn=0.19.2

Now check the version installed correctly or not?

conda list 

Output is:

scikit-learn              0.19.2          py36_blas_openblasha84fab4_201  [blas_openblas]  conda-forge

Note: Don't use pip command if you are using Anaconda or Miniconda

I tried following commands:

!conda update conda 
!pip install -U scikit-learn

It will install the required packages also will show in the conda list but when try to import that package it will not work.

On the website http://scikit-learn.org/stable/install.html it is mentioned as: Warning To upgrade or uninstall scikit-learn installed with Anaconda or conda you should not use the pip.

I was trying to install fancyimpute package for imputation but there was not luck. But when i tried below commands, it got installed: Commands:

conda update conda
conda update anaconda
pip install fancyimpute 

(here i was trying to give command conda install fancyimpute which did't work)

This answer is only relevant to a specific package in your environment at a particular movement in time, and is unlikely to ever benefit anyone else. – AMC Feb 27, 2020 at 18:04

Even i was facing the same problem ,but solved it by

conda install -c conda-forge pysoundfile

while importing it

import soundfile 
                This answer is only relevant to a specific package in your environment at a particular movement in time, and is unlikely to ever benefit anyone else.
– AMC
                Feb 27, 2020 at 18:03

Conda itself provides a quite detailed guidance about installing non-conda packages. Details can be found here: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html

The basic idea is to use conda-forge. If it doesn't work, activate the environment and use pip.

I encountered the same problem while I was working with a non-conda package named matplotlib-venn, where simple commands like conda install <package> and conda install -c conda-forge <package> both resulted in the same PackagesNotFoundError.

However, I realized that if you search your package on the conda-forge website https://anaconda.org/conda-forge, it will list out a series of commands that you can tryout. For me, the second command conda install -c conda-forge/label/gcc7 matplotlib-venn worked successfully.

Note: you may need to add conda-forge to your list of channels by using conda config --append channels conda-forge

  • in which case "(base)" will most probably show at the start or your terminal command prompt.
  • ... and pip is installed in your base environment ...

  • which it is: $ conda list | grep pip
  • ... then install the not-found package simply by $ pip install <packagename>

     
    推荐文章