【问题标题】:Poetry hangs when installing torch安装火炬时诗歌挂起
【发布时间】:2021-07-06 12:04:58
【问题描述】:

我正在尝试添加pytorch_pretrained_bert 包,但它在下载torch 时挂起。我已经等了将近30分钟了。我正在运行这个命令:poetry add pytorch_pretrained_bert -vvv,输出如下:

PS C:\Users\aaaa\Desktop\AI\nexus\ocr> poetry add pytorch_pretrained_bert -vvv
Using virtualenv: C:\Users\aaaa\AppData\Local\pypoetry\Cache\virtualenvs\ocr-MxNkBiZL-py3.8
PyPI: 10 packages found for pytorch-pretrained-bert *
Using version ^0.6.2 for pytorch-pretrained-bert

Updating dependencies
Resolving dependencies...
   1: fact: ocr is 0.1.0
   1: derived: ocr
   1: fact: ocr depends on click (^8.0.1)
   1: fact: ocr depends on pytesseract (^0.3.8)
   1: fact: ocr depends on opencv-contrib-python (^4.5.2)
   1: fact: ocr depends on numpy (^1.21.0)
   1: fact: ocr depends on pdf2image (^1.16.0)
   1: fact: ocr depends on poppler-utils (^0.1.0)
   1: fact: ocr depends on deskew (^0.10.30)
   1: fact: ocr depends on pytorch-pretrained-bert (^0.6.2)
   1: fact: ocr depends on pytest (^5.2)
   1: fact: ocr depends on pytest (^5.2)
   1: selecting ocr (0.1.0)
   1: derived: pytest (>=5.2,<6.0)
   1: derived: pytorch-pretrained-bert (>=0.6.2,<0.7.0)
   1: derived: deskew (>=0.10.30,<0.11.0)
   1: derived: poppler-utils (>=0.1.0,<0.2.0)
   1: derived: pdf2image (>=1.16.0,<2.0.0)
   1: derived: numpy (>=1.21.0,<2.0.0)
   1: derived: opencv-contrib-python (>=4.5.2,<5.0.0)
   1: derived: pytesseract (>=0.3.8,<0.4.0)
   1: derived: click (>=8.0.1,<9.0.0)
   1: fact: pytest (5.4.3) depends on py (>=1.5.0)
   1: fact: pytest (5.4.3) depends on packaging (*)
   1: fact: pytest (5.4.3) depends on attrs (>=17.4.0)
   1: fact: pytest (5.4.3) depends on more-itertools (>=4.0.0)
   1: fact: pytest (5.4.3) depends on pluggy (>=0.12,<1.0)
   1: fact: pytest (5.4.3) depends on wcwidth (*)
   1: fact: pytest (5.4.3) depends on atomicwrites (>=1.0)
   1: fact: pytest (5.4.3) depends on colorama (*)
   1: selecting pytest (5.4.3)
   1: derived: colorama
   1: derived: atomicwrites (>=1.0)
   1: derived: wcwidth
   1: derived: pluggy (>=0.12,<1.0)
   1: derived: more-itertools (>=4.0.0)
   1: derived: attrs (>=17.4.0)
   1: derived: packaging
   1: derived: py (>=1.5.0)
PyPI: 1 packages found for pytorch-pretrained-bert >=0.6.2,<0.7.0
   1: fact: pytorch-pretrained-bert (0.6.2) depends on torch (>=0.4.1)
   1: fact: pytorch-pretrained-bert (0.6.2) depends on numpy (*)
   1: fact: pytorch-pretrained-bert (0.6.2) depends on boto3 (*)
   1: fact: pytorch-pretrained-bert (0.6.2) depends on requests (*)
   1: fact: pytorch-pretrained-bert (0.6.2) depends on tqdm (*)
   1: fact: pytorch-pretrained-bert (0.6.2) depends on regex (*)
   1: selecting pytorch-pretrained-bert (0.6.2)
   1: derived: regex
   1: derived: tqdm
   1: derived: requests
   1: derived: boto3
   1: derived: torch (>=0.4.1)
   1: fact: deskew (0.10.30) depends on numpy (*)
   1: fact: deskew (0.10.30) depends on scikit-image (!=0.15.0)
   1: selecting deskew (0.10.30)
   1: derived: scikit-image (!=0.15.0)
   1: fact: poppler-utils (0.1.0) depends on Click (>=7.0)
   1: selecting poppler-utils (0.1.0)
   1: fact: pdf2image (1.16.0) depends on pillow (*)
   1: selecting pdf2image (1.16.0)
   1: derived: pillow
   1: selecting numpy (1.21.0)
   1: fact: opencv-contrib-python (4.5.2.54) depends on numpy (>=1.13.3)
   1: selecting opencv-contrib-python (4.5.2.54)
   1: fact: pytesseract (0.3.8) depends on Pillow (*)
   1: selecting pytesseract (0.3.8)
   1: fact: click (8.0.1) depends on colorama (*)
   1: selecting click (8.0.1)
   1: selecting wcwidth (0.2.5)
   1: selecting pluggy (0.13.1)
   1: selecting more-itertools (8.8.0)
   1: selecting attrs (21.2.0)
   1: fact: packaging (21.0) depends on pyparsing (>=2.0.2)
   1: selecting packaging (21.0)
   1: derived: pyparsing (>=2.0.2)
   1: selecting py (1.10.0)
   1: selecting regex (2021.7.6)
   1: fact: tqdm (4.61.2) depends on colorama (*)
   1: selecting tqdm (4.61.2)
   1: fact: requests (2.25.1) depends on chardet (>=3.0.2,<5)
   1: fact: requests (2.25.1) depends on idna (>=2.5,<3)
   1: fact: requests (2.25.1) depends on urllib3 (>=1.21.1,<1.27)
   1: fact: requests (2.25.1) depends on certifi (>=2017.4.17)
   1: selecting requests (2.25.1)
   1: derived: certifi (>=2017.4.17)
   1: derived: urllib3 (>=1.21.1,<1.27)
   1: derived: idna (>=2.5,<3)
   1: derived: chardet (>=3.0.2,<5)
   1: fact: boto3 (1.17.105) depends on botocore (>=1.20.105,<1.21.0)
   1: fact: boto3 (1.17.105) depends on jmespath (>=0.7.1,<1.0.0)
   1: fact: boto3 (1.17.105) depends on s3transfer (>=0.4.0,<0.5.0)
   1: selecting boto3 (1.17.105)
   1: derived: s3transfer (>=0.4.0,<0.5.0)
   1: derived: jmespath (>=0.7.1,<1.0.0)
   1: derived: botocore (>=1.20.105,<1.21.0)
   1: fact: torch (1.9.0) depends on typing-extensions (*)
   1: selecting torch (1.9.0)
   1: derived: typing-extensions
   1: fact: scikit-image (0.18.2) depends on numpy (>=1.16.5)
   1: fact: scikit-image (0.18.2) depends on scipy (>=1.0.1)
   1: fact: scikit-image (0.18.2) depends on matplotlib (>=2.0.0,<3.0.0 || >3.0.0)
   1: fact: scikit-image (0.18.2) depends on networkx (>=2.0)
   1: fact: scikit-image (0.18.2) depends on pillow (>=4.3.0,<7.1.0 || >7.1.0,<7.1.1 || >7.1.1)
   1: fact: scikit-image (0.18.2) depends on imageio (>=2.3.0)
   1: fact: scikit-image (0.18.2) depends on tifffile (>=2019.7.26)
   1: fact: scikit-image (0.18.2) depends on PyWavelets (>=1.1.1)
   1: selecting scikit-image (0.18.2)
   1: derived: PyWavelets (>=1.1.1)
   1: derived: tifffile (>=2019.7.26)
   1: derived: imageio (>=2.3.0)
   1: derived: pillow (>=4.3.0,!=7.1.0,!=7.1.1)
   1: derived: networkx (>=2.0)
   1: derived: matplotlib (>=2.0.0,!=3.0.0)
   1: derived: scipy (>=1.0.1)
   1: selecting pillow (8.3.0)
   1: selecting pyparsing (2.4.7)
   1: selecting certifi (2021.5.30)
   1: selecting urllib3 (1.26.6)
   1: selecting idna (2.10)
   1: selecting chardet (4.0.0)
   1: fact: s3transfer (0.4.2) depends on botocore (>=1.12.36,<2.0a.0)
   1: selecting s3transfer (0.4.2)
   1: selecting jmespath (0.10.0)
   1: fact: botocore (1.20.105) depends on jmespath (>=0.7.1,<1.0.0)
   1: fact: botocore (1.20.105) depends on python-dateutil (>=2.1,<3.0.0)
   1: fact: botocore (1.20.105) depends on urllib3 (>=1.25.4,<1.27)
   1: selecting botocore (1.20.105)
   1: derived: python-dateutil (>=2.1,<3.0.0)
   1: selecting typing-extensions (3.10.0.0)
   1: fact: pywavelets (1.1.1) depends on numpy (>=1.13.3)
   1: selecting pywavelets (1.1.1)
   1: fact: tifffile (2021.7.2) depends on numpy (>=1.15.1)
   1: selecting tifffile (2021.7.2)
   1: fact: imageio (2.9.0) depends on numpy (*)
   1: fact: imageio (2.9.0) depends on pillow (*)
   1: selecting imageio (2.9.0)
   1: fact: networkx (2.5.1) depends on decorator (>=4.3,<5)
   1: selecting networkx (2.5.1)
   1: derived: decorator (>=4.3,<5)
   1: fact: matplotlib (3.4.2) depends on cycler (>=0.10)
   1: fact: matplotlib (3.4.2) depends on kiwisolver (>=1.0.1)
   1: fact: matplotlib (3.4.2) depends on numpy (>=1.16)
   1: fact: matplotlib (3.4.2) depends on pillow (>=6.2.0)
   1: fact: matplotlib (3.4.2) depends on pyparsing (>=2.2.1)
   1: fact: matplotlib (3.4.2) depends on python-dateutil (>=2.7)
   1: selecting matplotlib (3.4.2)
   1: derived: python-dateutil (>=2.7)
   1: derived: kiwisolver (>=1.0.1)
   1: derived: cycler (>=0.10)
   1: fact: scipy (1.6.1) depends on numpy (>=1.16.5)
   1: selecting scipy (1.6.1)
   1: fact: python-dateutil (2.8.1) depends on six (>=1.5)
   1: selecting python-dateutil (2.8.1)
   1: derived: six (>=1.5)
   1: selecting decorator (4.4.2)
   1: selecting kiwisolver (1.3.1)
   1: fact: cycler (0.10.0) depends on six (*)
   1: selecting cycler (0.10.0)
   1: selecting six (1.16.0)
   1: selecting colorama (0.4.4)
   1: selecting atomicwrites (1.4.0)
   1: Version solving took 0.246 seconds.
   1: Tried 1 solutions.

Finding the necessary packages for the current system

Package operations: 2 installs, 0 updates, 0 removals, 42 skipped

  • Installing six (1.16.0): Skipped for the following reason: Already installed
  • Installing jmespath (0.10.0): Skipped for the following reason: Already installed
  • Installing python-dateutil (2.8.1): Skipped for the following reason: Already installed
  • Installing urllib3 (1.26.6): Skipped for the following reason: Already installed
  • Installing botocore (1.20.105): Skipped for the following reason: Already installed
  • Installing cycler (0.10.0): Skipped for the following reason: Already installed
  • Installing kiwisolver (1.3.1): Skipped for the following reason: Already installed
  • Installing pillow (8.3.0): Skipped for the following reason: Already installed
  • Installing decorator (4.4.2): Skipped for the following reason: Already installed
  • Installing numpy (1.21.0): Skipped for the following reason: Already installed
  • Installing pyparsing (2.4.7): Skipped for the following reason: Already installed
  • Installing certifi (2021.5.30): Skipped for the following reason: Already installed
  • Installing chardet (4.0.0): Skipped for the following reason: Already installed
  • Installing imageio (2.9.0): Skipped for the following reason: Already installed
  • Installing networkx (2.5.1): Skipped for the following reason: Already installed
  • Installing colorama (0.4.4): Skipped for the following reason: Already installed
  • Installing scipy (1.6.1): Skipped for the following reason: Already installed
  • Installing pywavelets (1.1.1): Skipped for the following reason: Already installed
  • Installing matplotlib (3.4.2): Skipped for the following reason: Already installed
  • Installing tifffile (2021.7.2): Skipped for the following reason: Already installed
  • Installing typing-extensions (3.10.0.0): Skipped for the following reason: Already installed
  • Installing s3transfer (0.4.2): Skipped for the following reason: Already installed
  • Installing idna (2.10): Skipped for the following reason: Already installed
  • Installing atomicwrites (1.4.0): Skipped for the following reason: Already installed
  • Installing attrs (21.2.0): Skipped for the following reason: Already installed
  • Installing click (8.0.1): Skipped for the following reason: Already installed
  • Installing packaging (21.0): Skipped for the following reason: Already installed
  • Installing more-itertools (8.8.0): Skipped for the following reason: Already installed
  • Installing boto3 (1.17.105): Skipped for the following reason: Already installed
  • Installing py (1.10.0): Skipped for the following reason: Already installed
  • Installing requests (2.25.1): Skipped for the following reason: Already installed
  • Installing scikit-image (0.18.2): Skipped for the following reason: Already installed
  • Installing wcwidth (0.2.5): Skipped for the following reason: Already installed
  • Installing tqdm (4.61.2): Skipped for the following reason: Already installed
  • Installing torch (1.9.0)
  • Installing pluggy (0.13.1): Skipped for the following reason: Already installed
  • Installing regex (2021.7.6): Skipped for the following reason: Already installed

如您所见,安装尚未完成。可能是什么原因?我使用的是 Windows 10 操作系统并在Windows PowerShell 中运行命令。

【问题讨论】:

    标签: python windows installation pytorch python-poetry


    【解决方案1】:

    TL;DR:这很容易通过绿色版本号和点as shown in this screenshot 或运行poetry run &lt;package&gt; --version 并成功输出来验证。

    简答

    当我用 Poetry 安装包时,我看到一些包,比如 pylint,只显示行

    Installing pylint (2.11.1)
    

    并且似乎永远不会完成。但是如果我跑

    poetry run pylint --version
    

    它会在诗歌 venv 中打印出安装的版本:

    pylint 2.11.1
    astroid 2.8.3
    Python 3.9.7 (default, Sep 3 2021, ...)
    

    更长的答案

    不确定这是否是 Poetry 的最新更改,但目前使用 Poetry 的预览版 1.2.0a2,运行 poetry add &lt;package&gt; -vvv 后的输出看起来像这样,表示分别解决依赖关系和安装进度:

    $ poetry add pylint -vvv
    Loading configuration file ...
    Using virtualenv: ...
    PyPI: 1 packages found for pylint
    
    Updating dependencies
    Resolving dependencies...
       1: fact: pylint (2.11.1) depends on platformdirs (>=2.2.0)
       1: fact: pylint (2.11.1) depends on astroid (>=2.8.0,<2.9)
       1: fact: pylint (2.11.1) depends on isort (>=4.2.5,<6)
       1: fact: pylint (2.11.1) depends on mccabe (>=0.6,<0.7)
       1: fact: pylint (2.11.1) depends on toml (>=0.7.1)
       1: fact: pylint (2.11.1) depends on typing-extensions (>=3.10.0)
       1: fact: pylint (2.11.1) depends on colorama (*)
       1: selecting pylint (2.11.1)
       1: derived: typing-extensions (>=3.10.0)
       1: derived: toml (>=0.7.1)
       1: derived: mccabe (>=0.6,<0.7)
       1: derived: isort (>=4.2.5,<6)
       1: derived: astroid (>=2.8.0,<2.9)
       1: derived: platformdirs (>=2.2.0)
    PyPI: 1 packages found for pylint
    ...
    
    Writing lock file
    
    Finding the necessary packages for the current system
    
    Package operations: 6 installs, 0 updates, 0 removals, 0 skipped
    
      • Installing pylint (2.11.1): Pending...
      • Installing pytest (2.11.1): Installing...
      • Installing pytest (2.11.1)  # dot and version will be green to indicate package was installed
    

    请注意,输出最初会以Pending... 开头,并且可能会将原行更新为Downloading X%,然后Installing... 或在新行上输出。因此,如果您单独看到一行,则可能已安装该软件包。这很容易通过绿色版本号和点as shown in this screenshot 或运行poetry run &lt;package&gt; --version 并成功输出来验证。

    希望这个额外的输出能够阐明您正在安装的软件包的安装状态。

    【讨论】:

      猜你喜欢
      • 2020-12-11
      • 2020-05-05
      • 1970-01-01
      • 2022-08-11
      • 1970-01-01
      • 1970-01-01
      • 2021-09-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多