我已经使用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的模式。
我终于找到了这个问题的解决方案(请参阅注释(。问题出在我的conda配置上,当时我在离线模式下工作。为了解决这个问题,我刚刚运行:
conda config --set offline false
谢谢你的帮助@merv!
安装的软件包将显示在pip列表或conda列表中,但从jupyter调用时会引发导入错误。
经过数小时的搜寻;更新索引";Anaconda导航器的按钮解决了我的问题。Anaconda Navigator 的更新索引按钮