打破了我的康达。无法再从自定义渠道安装软件包

发布于 2025-01-09 05:56:56 字数 6551 浏览 0 评论 0 原文

我继承了一台安装了 Anaconda 的机器,我必须在该机器上管理我的 python 环境。

我在网络共享上有一个自定义通道,用于托管 conda 包。它具有最高优先级。

一切都令我满意,除了 conda update -n base -c defaults conda 变得非常慢。有时我必须在几个小时后杀死它。

在寻找加速环境解决的解决方案后,我编辑了 conda config 通过这样做:

conda config --set channel_priority strict
conda config --set default_threads 4

这两者都没有帮助,所以我恢复到以前的 conda 配置设置。

现在,当我尝试将包从我的频道更新/安装到任何环境时,它都会失败。 安装像 numpy 这样的标准包仍然有效。

为了简单起见,我仅使用 python 创建了一个“scratch”环境。它包含:

# packages in environment at C:\ProgramData\Anaconda3\envs\scratch:
#
# Name                    Version                   Build  Channel
ca-certificates           2021.10.26           haa95532_4
certifi                   2021.10.8        py39haa95532_2
openssl                   1.1.1m               h2bbff1b_0
pip                       21.2.4           py39haa95532_0
python                    3.9.7                h6244533_1
setuptools                58.0.4           py39haa95532_0
sqlite                    3.37.2               h2bbff1b_0
tzdata                    2021e                hda174b7_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.1             pyhd3eb1b0_0
wincertstore              0.2              py39haa95532_2

我有一个包 foo_package,conda 在我的频道上看到它:

(scratch) PS C:\Users\griffin> conda search foo_package
Loading channels: done
# Name                       Version           Build  Channel
foo_package                     1.0          py36_0  custom_packages
foo_package                     1.0          py37_0  custom_packages
foo_package                     1.0          py38_0  custom_packages
foo_package                     1.0          py39_0  custom_packages

当我尝试安装它时:

(scratch) PS C:\Users\griffin> conda install foo_package
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - foo_package -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

我不知道它从哪里获取 python[version='>= 2.7,<2.8.0a0|>=3.5,<3.6.0a0'] 依赖项。我的包的元数据非常简单:

package:
  name: foo_package
  version: 1.0

source:
  path: .

requirements:
  host:
    - python
  run:
    - python
    - redis-py

相同的设置继续在我的其他机器上运行。所以我觉得这一定与配置有关。

我查看了所有可能的放置一个 condarc 文件。我找到了两个,它们似乎是矛盾的。所以我删除了它们并将我的自定义频道重新添加到列表中。

但问题仍然存在。我能做什么?

我当前的 conda 配置如下所示:

(base) PS C:\Users\griffin> conda config --show
add_anaconda_token: True
add_pip_as_python_dependency: True
aggressive_update_packages:
  - ca-certificates
  - certifi
  - openssl
allow_conda_downgrades: False
allow_cycles: True
allow_non_channel_urls: False
allow_softlinks: False
always_copy: False
always_softlink: False
always_yes: None
anaconda_upload: None
auto_activate_base: True
auto_stack: 0
auto_update_conda: True
bld_path:
changeps1: True
channel_alias: https://conda.anaconda.org
channel_priority: flexible
channels:
  - N:\path\to\channel\custom_packages
  - defaults
client_ssl_cert: None
client_ssl_cert_key: None
clobber: False
conda_build: {}
create_default_packages: []
croot: C:\ProgramData\Anaconda3\conda-bld
custom_channels:
  pkgs/main: https://repo.anaconda.com
  pkgs/r: https://repo.anaconda.com
  pkgs/msys2: https://repo.anaconda.com
  pkgs/pro: https://repo.anaconda.com
custom_multichannels:
  defaults:
    - https://repo.anaconda.com/pkgs/main
    - https://repo.anaconda.com/pkgs/r
    - https://repo.anaconda.com/pkgs/msys2
  local:
debug: False
default_channels:
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - https://repo.anaconda.com/pkgs/msys2
default_python: 3.7
default_threads: None
deps_modifier: not_set
dev: False
disallowed_packages: []
download_only: False
dry_run: False
enable_private_envs: False
env_prompt: ({default_env})
envs_dirs:
  - C:\ProgramData\Anaconda3\envs
  - C:\Users\griffin\.conda\envs
  - C:\Users\griffin\AppData\Local\conda\conda\envs
error_upload_url: https://conda.io/conda-post/unexpected-error
execute_threads: 1
extra_safety_checks: False
force: False
force_32bit: False
force_reinstall: False
force_remove: False
ignore_pinned: False
json: False
local_repodata_ttl: 1
migrated_channel_aliases: []
migrated_custom_channels: {}
non_admin_enabled: True
notify_outdated_conda: True
offline: False
override_channels_enabled: True
path_conflict: clobber
pinned_packages: []
pip_interop_enabled: False
pkgs_dirs:
  - C:\ProgramData\Anaconda3\pkgs
  - C:\Users\griffin\.conda\pkgs
  - C:\Users\griffin\AppData\Local\conda\conda\pkgs
proxy_servers: {}
quiet: False
remote_backoff_factor: 1
remote_connect_timeout_secs: 9.15
remote_max_retries: 3
remote_read_timeout_secs: 60.0
repodata_fns:
  - current_repodata.json
  - repodata.json
repodata_threads: None
report_errors: None
restore_free_channel: False
rollback_enabled: True
root_prefix: C:\ProgramData\Anaconda3
safety_checks: warn
sat_solver: pycosat
separate_format_cache: False
shortcuts: True
show_channel_urls: None
signing_metadata_url_base: None
solver_ignore_timestamps: False
ssl_verify: True
subdir: win-64
subdirs:
  - win-64
  - noarch
target_prefix_override:
track_features: []
unsatisfiable_hints: True
unsatisfiable_hints_check_depth: 2
update_modifier: update_specs
use_index_cache: False
use_local: False
use_only_tar_bz2: True
verbosity: 0
verify_threads: 1
whitelist_channels: []

I've inherited a machine, with an Anaconda installation, on which I must manage my python environments.

I have a custom channel, on a network share, that I host my conda packages on. It has the highest priority.

Everything was working to my satisfaction, except that conda update -n base -c defaults conda has become extremely slow. Sometimes I have to kill it after a few hours.

After looking for solutions to speed up environment solve, I edited my conda config by doing:

conda config --set channel_priority strict
conda config --set default_threads 4

Neither of which helped, so I reverted to my previous conda config settings.

Now, when I try to update/install a package from my channel to any environment it fails. Installing standard packages like numpy still works.

To keep things simple, I have created a "scratch" environment with python only. It contains:

# packages in environment at C:\ProgramData\Anaconda3\envs\scratch:
#
# Name                    Version                   Build  Channel
ca-certificates           2021.10.26           haa95532_4
certifi                   2021.10.8        py39haa95532_2
openssl                   1.1.1m               h2bbff1b_0
pip                       21.2.4           py39haa95532_0
python                    3.9.7                h6244533_1
setuptools                58.0.4           py39haa95532_0
sqlite                    3.37.2               h2bbff1b_0
tzdata                    2021e                hda174b7_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.1             pyhd3eb1b0_0
wincertstore              0.2              py39haa95532_2

I have a package foo_package, which conda sees on my channel:

(scratch) PS C:\Users\griffin> conda search foo_package
Loading channels: done
# Name                       Version           Build  Channel
foo_package                     1.0          py36_0  custom_packages
foo_package                     1.0          py37_0  custom_packages
foo_package                     1.0          py38_0  custom_packages
foo_package                     1.0          py39_0  custom_packages

When I try to install it:

(scratch) PS C:\Users\griffin> conda install foo_package
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - foo_package -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

I have no idea where it is getting that python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0'] dependency from. The meta data for my package is very simple:

package:
  name: foo_package
  version: 1.0

source:
  path: .

requirements:
  host:
    - python
  run:
    - python
    - redis-py

The same set up continues to work on my other machines. So I feel it must be something to do with the configuration.

I looked at all the possible places a condarc file could be. I found two, and they seemed contradictory. So I deleted them both and re-added my custom channel to the list.

But the issue persists. What can I do?

My current conda config looks like so:

(base) PS C:\Users\griffin> conda config --show
add_anaconda_token: True
add_pip_as_python_dependency: True
aggressive_update_packages:
  - ca-certificates
  - certifi
  - openssl
allow_conda_downgrades: False
allow_cycles: True
allow_non_channel_urls: False
allow_softlinks: False
always_copy: False
always_softlink: False
always_yes: None
anaconda_upload: None
auto_activate_base: True
auto_stack: 0
auto_update_conda: True
bld_path:
changeps1: True
channel_alias: https://conda.anaconda.org
channel_priority: flexible
channels:
  - N:\path\to\channel\custom_packages
  - defaults
client_ssl_cert: None
client_ssl_cert_key: None
clobber: False
conda_build: {}
create_default_packages: []
croot: C:\ProgramData\Anaconda3\conda-bld
custom_channels:
  pkgs/main: https://repo.anaconda.com
  pkgs/r: https://repo.anaconda.com
  pkgs/msys2: https://repo.anaconda.com
  pkgs/pro: https://repo.anaconda.com
custom_multichannels:
  defaults:
    - https://repo.anaconda.com/pkgs/main
    - https://repo.anaconda.com/pkgs/r
    - https://repo.anaconda.com/pkgs/msys2
  local:
debug: False
default_channels:
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - https://repo.anaconda.com/pkgs/msys2
default_python: 3.7
default_threads: None
deps_modifier: not_set
dev: False
disallowed_packages: []
download_only: False
dry_run: False
enable_private_envs: False
env_prompt: ({default_env})
envs_dirs:
  - C:\ProgramData\Anaconda3\envs
  - C:\Users\griffin\.conda\envs
  - C:\Users\griffin\AppData\Local\conda\conda\envs
error_upload_url: https://conda.io/conda-post/unexpected-error
execute_threads: 1
extra_safety_checks: False
force: False
force_32bit: False
force_reinstall: False
force_remove: False
ignore_pinned: False
json: False
local_repodata_ttl: 1
migrated_channel_aliases: []
migrated_custom_channels: {}
non_admin_enabled: True
notify_outdated_conda: True
offline: False
override_channels_enabled: True
path_conflict: clobber
pinned_packages: []
pip_interop_enabled: False
pkgs_dirs:
  - C:\ProgramData\Anaconda3\pkgs
  - C:\Users\griffin\.conda\pkgs
  - C:\Users\griffin\AppData\Local\conda\conda\pkgs
proxy_servers: {}
quiet: False
remote_backoff_factor: 1
remote_connect_timeout_secs: 9.15
remote_max_retries: 3
remote_read_timeout_secs: 60.0
repodata_fns:
  - current_repodata.json
  - repodata.json
repodata_threads: None
report_errors: None
restore_free_channel: False
rollback_enabled: True
root_prefix: C:\ProgramData\Anaconda3
safety_checks: warn
sat_solver: pycosat
separate_format_cache: False
shortcuts: True
show_channel_urls: None
signing_metadata_url_base: None
solver_ignore_timestamps: False
ssl_verify: True
subdir: win-64
subdirs:
  - win-64
  - noarch
target_prefix_override:
track_features: []
unsatisfiable_hints: True
unsatisfiable_hints_check_depth: 2
update_modifier: update_specs
use_index_cache: False
use_local: False
use_only_tar_bz2: True
verbosity: 0
verify_threads: 1
whitelist_channels: []

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文