故障排除#
本页详细介绍了一些常见问题及其各自的解决方法。有关 Anaconda 安装或技术支持选项,请访问我们的支持产品页面。
提示
您可以使用浏览器的搜索功能在此页面中搜索信息:Ctrl+F (Windows)/Cmd+F (Mac)。
从 Anaconda 通道收到 403 错误#
提示
如果您正在使用 Anaconda 托管的conda-forge
并收到 403 错误,请参阅从托管 conda-forge 接收 403 错误。
原因
403 错误是 Web 服务器在禁止客户端访问资源时发出的一般 HTTP 错误。换句话说,如果您收到 403 错误,conda 会认为该通道不存在,或者您没有使用它的权限。
您收到的 403 错误可能如下所示:
Collecting package metadata (current_repodata.json): failed
UnavailableInvalidChannel: HTTP 403 FORBIDDEN for channel main <https://repo.anaconda.com/repo/main>
The channel is not accessible or is invalid.
You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.
收到此错误的可能原因有以下几种:
您在
.condarc
文件。防火墙或其他安全设备或系统阻止用户访问。
由于可能违反服务条款,访问被阻止。
解决方案
首先,仔细检查您的通道配置并验证是否已正确输入地址。
如果失败,请与您的 IT 管理员联系,以确保您的代理或防火墙不会阻止流向存储库通道的流量。
如果您确定流量未被阻止并且您的问题仍然存在,请打开支持票证。
HTTP 000 连接失败#
原因
这通常是由代理配置错误引起的,可以通过正确设置代理服务器来纠正。但是,由于某些企业没有提供 SSL 证书的简单方法,因此 Anaconda 建议您在遇到此错误时绕过 SSL 验证步骤。
解决方案
如果您收到此错误消息,请首先运行以下命令:
conda config --set ssl_verify false
(Package Security Manager 用户)如有必要,安装conda-token
通过运行以下命令:
conda install conda-token --channel https://repo.anaconda.cloud/repo/anaconda-tools --name base
(Package Security Manager 用户)通过运行以下命令,确保Token验证步骤忽略 SSL 错误:
# Replace <TOKEN> with your token
conda token set --no-ssl-verify <TOKEN>
您可能会看到以下警告,但您可以放心地忽略它:
/Users/<USERNAME>/Applications/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'repo.anaconda.cloud'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
由于策略筛选,环境创建失败#
原因
无一例外地实施严格的策略过滤器可能会导致从存储库中筛选出基本的软件包依赖项。如果没有这些软件包,像
conda create --name <ENV_NAME> python=3.11
将失败。如果您尝试创建新环境,但您的构建由于软件包冲突或软件包不可用而失败,则可能是由于 IT 团队严格的策略过滤器。您可以请求将包例外添加到策略筛选器中,但您需要先知道哪些包导致了问题。
解决方案
要执行此测试,您需要一个未应用策略筛选条件的通道。在组织中创建频道并为其命名
quarantine
.创建后,将其添加到您的.condarc
文件。有关将频道添加到您的.condarc
文件中,请参阅通道。创建隔离通道并将其添加到您的
.condarc
文件中,您可以运行以下命令:
# Replace <ENV_NAME> with a test environment name (this is not permanent)
# Replace <CHANNEL> with your channel name
conda create --name <ENV_NAME> --channel <CHANNEL> --channel quarantine python=3.11 --dry-run
注意
如果您在.condarc
中,您可以只使用通道名称和--channel
论点。否则,可以将完整通道 URL 与--channel
论点。您可以从 Channels 页面复制渠道 URL。有关设置通道别名的更多信息,请参阅使用 .condarc conda 配置文件。
例如,如果您尝试测试从 snakes 通道构建环境,则命令为:
conda create --name test_environment --channel snakes --channel quarantine python=3.11 --dry-run
谨慎
的排序snakes
和quarantine
是必不可少的。Conda 将尝试按照通道的列出顺序解决环境问题,因此quarantine
必须列在最后。
命令返回示例:
## Package Plan ##
environment location: /Users/<USER>/opt/anaconda3/envs/test_env
added / updated specs:
- python=3.11
The following packages will be downloaded:
package | build
---------------------------|-----------------
bzip2-1.0.8 | h80987f9_5 129 KB snakes
ca-certificates-2023.12.12 | hca03da5_0 127 KB snakes
libffi-3.4.4 | hca03da5_0 120 KB snakes
ncurses-6.4 | h313beb8_0 884 KB quarantine
openssl-3.0.13 | h1a28f6b_0 5.0 MB quarantine
pip-23.3.1 | py311hca03da5_0 3.3 MB quarantine
python-3.11.8 | hb885b13_0 15.5 MB snakes
readline-8.2 | h1a28f6b_0 353 KB snakes
setuptools-68.2.2 | py311hca03da5_0 1.2 MB snakes
sqlite-3.41.2 | h80987f9_0 1.1 MB quarantine
tk-8.6.12 | hb8d0fd4_0 2.9 MB snakes
tzdata-2024a | h04d1e81_0 116 KB snakes
wheel-0.41.2 | py311hca03da5_0 142 KB quarantine
xz-5.4.6 | h80987f9_0 372 KB snakes
zlib-1.2.13 | h5a0b063_0 82 KB quarantine
------------------------------------------------------------
Total: 31.4 MB
The following NEW packages will be INSTALLED:
bzip2 snakes/osx-arm64::bzip2-1.0.8-h80987f9_5
ca-certificates snakes/osx-arm64::ca-certificates-2023.12.12-hca03da5_0
libffi snakes/osx-arm64::libffi-3.4.4-hca03da5_0
ncurses quarantine/osx-arm64::ncurses-6.4-h313beb8_0
openssl quarantine/osx-arm64::openssl-3.0.13-h1a28f6b_0
pip quarantine/osx-arm64::pip-23.3.1-py311hca03da5_0
python snakes/osx-arm64::python-3.11.8-hb885b13_0
readline snakes/osx-arm64::readline-8.2-h1a28f6b_0
setuptools snakes/osx-arm64::setuptools-68.2.2-py311hca03da5_0
sqlite quarantine/osx-arm64::sqlite-3.41.2-h80987f9_0
tk snakes/osx-arm64::tk-8.6.12-hb8d0fd4_0
tzdata snakes/noarch::tzdata-2024a-h04d1e81_0
wheel quarantine/osx-arm64::wheel-0.41.2-py311hca03da5_0
xz snakes/osx-arm64::xz-5.4.6-h80987f9_0
zlib quarantine/osx-arm64::zlib-1.2.13-h5a0b063_0
DryRunExit: Dry run. Exiting.
从quarantine
channel 是需要考虑在 policy 过滤器中排除的包。
从 hosted 收到 403 错误conda-forge
#
原因
如果您已与 Anaconda 托管的conda-forge
频道,并且已经开始收到 403 错误,而您最初没有收到这些错误,则可能是您最近重新颁发了Token。此问题的根源在于,此新颁发的Token没有提供给先前Token的权限。
您的 403 错误可能如下所示:
Loading channels: failed
UnavailableInvalidChannel: HTTP 403 FORBIDDEN for channel conda-forge <https://repo.anaconda.cloud/repo/conda-forge>
The channel is not accessible or is invalid.
You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.
解决方案
要为conda-forge
频道中,导航到您组织的 Token Access (Token访问) 页面,然后单击 Sync token (同步Token)。