Conda找不到要安装的软件包

时间:2020-11-02 18:40:33

标签: python conda anaconda3

我使用conda已有一段时间了,没有任何问题,而现在,当我尝试安装软件包时,我开始出现PackagesNotFoundError错误。例如,如果我尝试:

conda install scipy --channel conda-forge

我得到这个:

PackagesNotFoundError: The following packages are not available from current channels:

  - scipy

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/bioconda/linux-64
  - https://conda.anaconda.org/bioconda/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://conda.anaconda.org/cgat/linux-64
  - https://conda.anaconda.org/cgat/noarch

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.

但是,如果我使用anaconda搜索此软件包,则可以在conda-forge频道中看到它。然后,即使我使用anaconda建议的命令; conda install --channel https://conda.anaconda.org/conda-forge scipy,我得到同样的错误。

为解决此问题,我重新安装了新版本的conda,但问题仍然存在,目前我无法使用conda进行任何安装。有人可以告诉我出什么问题了吗?

更新

根据一些建议

我已经跑步:

conda clean -all
conda clean --index-cache
conda update conda

我仍然有同样的问题

我当前的conda版本是4.8.2

更新2

@merv建议使用vervose标志运行,所以我运行conda search -c conda-forge scipy -vvv并得到了这个信息:

DEBUG conda.gateways.logging:set_verbosity(231): verbosity set to 3
Loading channels: ...working... TRACE conda.gateways.disk.test:file_path_is_writable(25): checking path is writable /path/miniconda/pkgs/urls.txt
DEBUG conda.core.package_cache_data:_check_writable(259): package cache directory '/path/miniconda/pkgs' writable: True
INFO conda.core.subdir_data:query_all(94): Ignoring the following channel urls because mode is offline.
  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/bioconda/linux-64
  - https://conda.anaconda.org/bioconda/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://conda.anaconda.org/cgat/linux-64
  - https://conda.anaconda.org/cgat/noarch
done
No match found for: scipy. Search: *scipy*
INFO conda.core.subdir_data:query_all(94): Ignoring the following channel urls because mode is offline.
  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/bioconda/linux-64
  - https://conda.anaconda.org/bioconda/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://conda.anaconda.org/cgat/linux-64
  - https://conda.anaconda.org/cgat/noarch
Traceback (most recent call last):
  File "/path/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 1079, in __call__
    return func(*args, **kwargs)
  File "/path/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "/path/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 82, in do_call
    return getattr(module, func_name)(args, parser)
  File "/path/miniconda/lib/python3.6/site-packages/conda/cli/main_search.py", line 90, in execute
    raise PackagesNotFoundError((text_type(spec),), channels_urls)
conda.exceptions.PackagesNotFoundError: The following packages are not available from current channels:

  - scipy

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/bioconda/linux-64
  - https://conda.anaconda.org/bioconda/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://conda.anaconda.org/cgat/linux-64
  - https://conda.anaconda.org/cgat/noarch

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.

我认为说Ignoring the following channel urls because mode is offline的那部分很可能与此错误有关,因为我无法从任何渠道访问软件包。但是,我仍然不知道如何更改网址的模式。

1 个答案:

答案 0 :(得分:0)

我终于找到了解决此问题的方法(请参阅评论)。问题出在我的conda配置上,当时我在离线模式下工作。为了解决这个问题,我跑了:

conda config --set offline false

感谢您对@merv的帮助!