【问题标题】:An error occured while installing flair and pytorch with pipenv in windows with Pycharm在使用 Pycharm 的 windows 中使用 pipenv 安装 flair 和 pytorch 时发生错误
【发布时间】:2020-10-16 19:41:29
【问题描述】:

我在通过pipenv 安装python 包flairpytorch 时遇到问题,并且还不能解决这个问题。由于我正在尝试使用 Pipfile + Pipfile.lock 而不是 requirements.txt 对我的 python git 存储库进行版本控制,因此目前这是不可能的:

pipenv install flair

ERROR: Could not find a version that satisfies the requirement torch>=1.1.0 (from flair->-r c:\users\user.name\appdata\local\temp\pipenv-plyx3uwp-requirements\pipenv-xh_afa_r-requirement.txt (line 1)) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2) ERROR: No matching distribution found for torch>=1.1.0 (from flair->-r c:\users\user.name\appdata\local\temp\pipenv-plyx3uwp-requirements\pipenv-xh_afa_r-requirement.txt (line 1)) Installation Failed

我尝试了这些安装torchvision的变体:

pipenv install torchvision

安装torchvision 应该获取最新的torch版本

pipenv install torch==1.3

安装手电筒

pipenv install https://download.pytorch.org/whl/cu92/torch-0.4.1-cp37-cp37m-win_amd64.whl

安装torch的替代方法(这里有更多二进制文件:https://pytorch.org/get-started/previous-versions/#windows-binaries

pipenv install git+https://github.com/pytorch/vision#egg=torchvision

另一种方法,

错误文本:正在收集 torchvision
  下载 torchvision-0.5.0-cp37-cp37m-win_amd64.whl (1.2 MB)
收集 numpy
  使用缓存的 numpy-1.18.5-cp37-cp37m-win_amd64.whl (12.7 MB)
采集枕>=4.1.1
  下载 Pillow-7.1.2-cp37-cp37m-win_amd64.whl (2.0 MB)
收集六个
  下载 6-1.15.0-py2.py3-none-any.whl (10 kB)

pipenv install torchvision

users\user.name\appdata\local\temp\pipenv-hf2be0xq-requirements\pipenv-57akhz4j-requirement.txt(行
1))(来自版本:0.1.2、0.1.2.post1、0.1.2.post2)
错误:未找到 torch==1.4.0 的匹配分布(来自 torchvision->-r c:\users\user.name\appdat
a\local\temp\pipenv-hf2be0xq-requirements\pipenv-57akhz4j-requirement.txt(第 1 行)
安装失败

可以安装 torchvision 的唯一方法是不使用它的依赖包:

pipenv run pip install --no-deps torchvision

但这并没有解决通过 pipenv 安装 flair 的问题,因为需要依赖项。

【问题讨论】:

  • 提供您的 Python 版本。 torch python 包在很多 Python 版本中不可用。
  • 感谢您的回答。我有以下python版本:python 3.7.5 64bit
  • 能否创建一个新环境并运行pipenv install torch==1.3.1。输出是什么?
  • 同样的错误:ERROR: Could not find a version that satisfies the requirement torch==1.3.1 (from -r c:\users\user.name\appdata\local\temp\pipenv-fg5mza4n-requirements\pipenv-_7xxn7ek-requirement.txt (line 1)) (from versions : 0.1.2, 0.1.2.post1, 0.1.2.post2) ERROR: No matching distribution found for torch==1.3.1 (from -r c:\users\user.name\appdata\local\temp\pipenv-fg5mza4n-requirements\pipenv-_7xxn7ek-requirement.txt (line 1))

标签: python pytorch pipenv pipfile flair


【解决方案1】:

尝试先清理 Pipfile 和虚拟环境。它看起来像传递依赖和 Pipfile 中声明的冲突。

然后尝试像这样安装torchvision:

pipenv install torchvision 

这将安装最新的 torchvision 版本和兼容的 torch 版本:

Source:

torch   torchvision     python
master / nightly    master / nightly    >=3.6
1.5.0   0.6.0   >=3.5
1.4.0   0.5.0   ==2.7, >=3.5, <=3.8
1.3.1   0.4.2   ==2.7, >=3.5, <=3.7
1.3.0   0.4.1   ==2.7, >=3.5, <=3.7
1.2.0   0.4.0   ==2.7, >=3.5, <=3.7
1.1.0   0.3.0   ==2.7, >=3.5, <=3.7
<=1.0.1     0.2.2   ==2.7, >=3.5, <=3.7

Flair 可与 Pytorch 1.1+ 一起使用,如 here 所述:

该项目基于 PyTorch 1.1+ 和 Python 3.6+,因为方法 签名和类型提示很漂亮。

安装torchvision后继续安装flair:

pipenv install flair

在这里你可以找到一个工作的 Pipfile 和 Pipfile.lock 文件,这两个操作结束后:

点文件

名称=“pypi”
url = "https://pypi.org/simple"
verify_ssl = 真

[开发包]

[包]
火炬视觉 = "*"
天赋=“*”

[要求]
python_version = "3.6"

Pipfile.lock

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-22
    • 2020-03-19
    • 2013-03-18
    • 2019-10-30
    • 1970-01-01
    相关资源
    最近更新 更多