【问题标题】:pipenv is unable to find the right package version using pytorch indexpipenv 无法使用 pytorch 索引找到正确的包版本
【发布时间】:2022-02-19 06:40:45
【问题描述】:

我对@9​​87654323@ 如何解析可用的软件包版本感到困惑。我指定了索引,并且在他们的下载站点的列表中清楚地看到了 0.8.1 版本

这是我的pipenv 版本。我在 Mac OSX 上运行并通过brew 安装了 pipenv。

~ pipenv --version
pipenv, version 2021.5.29

点文件

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[[source]]
name = "pytorch"
url = "https://download.pytorch.org/whl/torch_stable.html"
verify_ssl = false

[packages]
...
torch = {index="pytorch", version="==1.7.1"}
torchtext = {index="pytorch", version="==0.8.1"}
...

[dev-packages]

[requires]
python_version = "3.7"

我运行pipenv install时的错误:

Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed! 
CRITICAL:pipenv.patched.notpip._internal.index.package_finder:Could not find a version that satisfies the requirement torchtext==0.8.1 (from -r /var/folders/0q/10lqt8nn6_l87q71lx_d233r0000gn/T/pipenv2ix9if8erequirements/pipenv-qm980cdf-constraints.txt (line 7)) (from versions: 0.1.1, 0.2.0, 0.2.1, 0.2.3, 0.3.1, 0.4.0, 0.5.0, 0.6.0)
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2021.5.29/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 741, in _main
...

错误告诉我找不到 0.8.1,我只能从超级有限的集合中选择。为什么是这样?我该怎么做才能解决这个问题?

【问题讨论】:

  • 我遇到了同样的问题,同时收到此错误CRITICAL:pipenv.patched.notpip._internal.resolution.resolvelib.factory:Could not find a version that satisfies the requirement torch~=1.7.1 (from versions: 1.9.0, 1.10.0, 1.10.1)您找到解决方案了吗?
  • @andrea 查看我的回答。修复起来真的很简单。 :)

标签: python python-3.x pytorch pipenv


【解决方案1】:

您使用了错误的 Python 版本。就是这么简单。

仔细阅读该列表中的库版本列表:

Torchtext 0.8.1 存在于:

  • cp36m = CPython 3.6m
  • cp37m = CPython 3.7m
  • cp38 = CPython 3.8
  • cp39 = CPython 3.9

您正在使用:CPython 3.7。

CPython 3.7(你的)和 CPython 3.7m(他们的)不是一回事。

“M”代表 Python 的特殊 malloc 版本,它更快。您不能在非“M”Python 上安装“M”库。

升级到 CPython 3.8 或 3.9。我建议同时使用 Pipenv + Pyenv,这样可以轻松安装不同版本的 CPython。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-14
    • 2018-12-14
    • 1970-01-01
    • 2020-05-02
    • 1970-01-01
    相关资源
    最近更新 更多