【发布时间】:2020-11-02 18:40:33
【问题描述】:
我使用 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 的部分很可能与此错误有关,因为我无法从任何渠道访问包。但是,我仍然不知道如何更改 url 的模式。
【问题讨论】:
-
不是解决方案,但可能是一种解决方法:您可以尝试 mamba,这是 conda 的快速替代品:
conda install -n base mamba,然后是mamba install -c conda-forge scipy。 -
也许可以试试
conda clean --index-cache?conda search -c conda-forge scipy会出现什么吗?另外,请在问题中添加 Conda 版本。 -
@merv 我现在更新了添加 conda 版本的问题。 conda
clean --all删除了很多东西,然后conda clean --index-cache没有任何进一步的影响。最后conda search -c conda-forge scipy显示同样的错误,说明conda无法访问频道。 -
@Geparada 很奇怪。我想知道
conda的依赖项之一是否无法正常运行。尝试使用详细标志 (-vvv) 运行,以查看内部是否出现警告。 -
conda config --set offline false应该切换该选项。希望就是这样,但不确定它最初是如何开启的。