【问题标题】:PackagesNotFoundError: The following packages are not available from current channels, AFTER adding conda-forge channel?PackagesNotFoundError:以下软件包在当前频道中不可用,添加 conda-forge 频道后?
【发布时间】:2021-03-12 07:31:51
【问题描述】:

即使按照此处的建议添加 conda forge 频道:

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

Conda 仍然无法在 requirements.txt 文件中安装许多软件包:

conda install --file pip_requirements/requirements.txt 
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

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

  - prompt-toolkit==1.0.16
  - torch==1.0.0
  - chainer==2.0.1
  - ipython-genutils==0.2.0
  - gym==0.9.2
  - lief
  - chainerrl==0.2.0

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/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

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.

如果 conda 甚至找不到像 TORCH 这样的流行包,那它有什么用?!

也试过用 pipenv 安装,也没有用..

pipenv install -r pip_requirements/requirements.txt 
Creating a virtualenv for this project…
Using /usr/bin/python3 (3.8.5) to create virtualenv…
⠋ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'
Error while trying to remove the /home/Johnny/.local/share/virtualenvs/myproject-uxejE6Q_ env: 
No such file or directory

Virtualenv location: 
Creating a Pipfile for this project…
Requirements file provided! Importing into Pipfile…
Creating a virtualenv for this project…
Using /usr/bin/python3 (3.8.5) to create virtualenv…
⠙ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'
Error while trying to remove the /home/Johnny/.local/share/virtualenvs/myproject-uxejE6Q_ env: 
No such file or directory

Virtualenv location: 
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…

Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Could not find a version that matches Pygments<3.0.0,==2.4.2,>=2.6.0
Tried: 0.5, 0.5.1, 0.6, 0.7, 0.7.1, 0.8, 0.8.1, 0.9, 0.10, 0.11, 0.11.1, 1.0, 1.1, 1.1.1, 1.2, 1.2.1, 1.2.2, 1.3, 1.3.1, 1.4, 1.5, 1.6rc1, 1.6, 2.0rc1, 2.0rc1, 2.0rc1, 2.0, 2.0, 2.0, 2.0.1, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.2, 2.1, 2.1, 2.1, 2.1.1, 2.1.1, 2.1.2, 2.1.2, 2.1.3, 2.1.3, 2.2.0, 2.2.0, 2.3.0, 2.3.0, 2.3.1, 2.3.1, 2.4.0, 2.4.0, 2.4.1, 2.4.1, 2.4.2, 2.4.2, 2.5.1, 2.5.1, 2.5.2, 2.5.2, 2.6.0, 2.6.0, 2.6.1, 2.6.1, 2.7.0, 2.7.0, 2.7.1, 2.7.1, 2.7.2, 2.7.2

【问题讨论】:

  • conda 找不到像 TORCH 这样的流行包有什么用?! 我不认为有一个名为 torch 的 Conda 包,那不是 Conda 的过错。我建议您熟悉一下 Conda 的基础知识。

标签: python virtualenv conda pipenv


【解决方案1】:

要安装 PyTorch,只需在 shell 中尝试此命令

conda install -c pytorch pytorch

【讨论】:

    【解决方案2】:

    有几个问题:

    1. 旧包。其中一些软件包可通过 defaults 和 conda-forge 渠道获得,但您请求的版本相当旧。如果您必须拥有这样的旧版本,请切换到 using a YAML,并包括 pip: 部分以从 PyPI 安装它们。

    2. 包命名。不幸的是,对于 Conda 包命名没有统一的强制政策,而且由于 Conda 支持比 PyPI 更广泛的语言库,因此不可避免地会出现命名冲突。 &lt;language&gt;-&lt;package&gt; 是一种常见但未被普遍采用的命名策略,对于 Python,通常是 py-&lt;package&gt;。我怀疑lief 是其中之一,也就是说,您实际上想要py-lief。

    3. 专业频道。并非每个包维护者都采用了 Conda Forge,PyTorch 是关键。如果你需要 PyTorch 包,你需要the pytorch channel。

    总体而言,请注意,您正在切换到一个新的生态系统,它并不完美,有时甚至不合理。不幸的是,没有简单的 pip freeze 到 conda install 工作流从 Conda 获取所有包。

    There is kind of an exception to this,也就是完全不使用Conda包管理,而是只用于环境的创建、隔离和激活。这样做会牺牲 Conda 提供的所有冗余减少和深度依赖解决方案,但我认为对于现有的基于 PyPI 的安装的快速而肮脏的重新创建它可能有时间和地点。

    否则,我建议在安装新软件包之前指出search Anaconda Cloud,以确保描述与实际想要安装的内容相符。

    【讨论】:

      猜你喜欢
      • 2018-07-07
      • 2018-07-27
      • 1970-01-01
      • 2021-12-10
      • 2020-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-20
      相关资源
      最近更新 更多