Poetry 更新失败:无法找到 pyqt5-qt5 (5.15.11) 的候选安装对象

Poetry Update Fails: Unable to Find Installation Candidates for pyqt5-qt5 (5.15.11)

提问人:xh x 提问时间:11/17/2023 更新时间:11/17/2023 访问量:62

问:

我的环境:

  • 操作系统: [Windows 22H2]
  • Python版本:[3.11]
  • 诗歌版本:[(version 1.7.1)]

尝试的解决方案:

  • 清除 Poetry 的缓存
  • 直接指定了不同版本的中。pyqt5-qt5pyproject.toml
  • 检查网络设置和代理配置

问题描述:

我在尝试使用 Poetry 更新我的 Python 项目依赖项时遇到了一个问题。具体来说,Poetry 无法找到版本 5.15.11 的安装候选者。以下是我尝试过但未解决问题的步骤:pyqt5-qt5

  • 清除了 Poetry 的缓存
  • 已确认我的网络连接稳定
  • 尝试指定不同版本的pyqt5-qt5

这是我运行时的输出:poetry update

(jsonrpc-py3.11) PS C:\PythonProject\pythonProject\jsonRPC> poetry update                                          
Updating dependencies
Resolving dependencies... (4.5s)

Package operations: 1 install, 0 updates, 0 removals

  • Installing pyqt5 (5.15.1): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  Traceback (most recent call last):
    File "C:\Users\nbdhc\AppData\Roaming\pypoetry\venv\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "C:\Users\nbdhc\AppData\Roaming\pypoetry\venv\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\nbdhc\AppData\Roaming\pypoetry\venv\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpcxilq025\.venv\Lib\site-packages\sipbuild\api.py", line 46, in build_wheel
      project = AbstractProject.bootstrap('wheel',
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpcxilq025\.venv\Lib\site-packages\sipbuild\abstract_project.py", line 87, in bootstrap
      project.setup(pyproject, tool, tool_description)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpcxilq025\.venv\Lib\site-packages\sipbuild\project.py", line 586, in setup
      self.apply_user_defaults(tool)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpl4qbme9n\PyQt5-5.15.1\project.py", line 64, in apply_user_defaults
      super().apply_user_defaults(tool)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpcxilq025\.venv\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults
      super().apply_user_defaults(tool)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpcxilq025\.venv\Lib\site-packages\sipbuild\project.py", line 237, in apply_user_defaults
      self.builder.apply_user_defaults(tool)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpcxilq025\.venv\Lib\site-packages\pyqtbuild\builder.py", line 69, in apply_user_defaults
      raise PyProjectOptionException('qmake',
  sipbuild.pyproject.PyProjectOptionException
  

  at ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\chef.py:164 in _prepare
      160│
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│
      163│             if error is not None:
    → 164│                 raise error from None
      165│
      166│             return path
      167│
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pyqt5 (5.15.1) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pyqt5 (==5.15.1)"'.

相反,当我通过pip安装pyqt5时,这是正常的:

(jsonrpc-py3.11) PS C:\PythonProject\pythonProject\jsonRPC> pip install pyqt5
Collecting pyqt5
  Using cached PyQt5-5.15.10-cp37-abi3-win_amd64.whl.metadata (2.2 kB)
Requirement already satisfied: PyQt5-sip<13,>=12.13 in c:\users\nbdhc\appdata\local\pypoetry\cache\virtualenvs\jsonrpc-1g8b7ov1-py3.11\lib\site-packages (from pyqt5) (12.13.0)
Collecting PyQt5-Qt5>=5.15.2 (from pyqt5)
  Using cached PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB)
Using cached PyQt5-5.15.10-cp37-abi3-win_amd64.whl (6.8 MB)
Installing collected packages: PyQt5-Qt5, pyqt5
Successfully installed PyQt5-Qt5-5.15.2 pyqt5-5.15.10

通过 pip 安装后,我将 pyproject.toml 的 [tool.poetry.dependencies] 修复为

[tool.poetry.dependencies]
python = "^3.11"
loguru = "^0.7.2"
sip = "^6.7.12"
pyqt5-sip = "^12.13.0"
pyqt5 = "=5.15.10"
pyqt5-qt  = "5.15.2"

诗歌的错误没有改变。

此外,运行还会导致错误:pip wheel --no-cache-dir --use-pep517 "pyqt5 (==5.15.1)"

$ pip wheel --no-cache-dir --use-pep517 "pyqt5 (==5.15.1)"

我也有错误。

(jsonrpc-py3.11) PS C:\PythonProject\pythonProject\jsonRPC> pip wheel --no-cache-dir --use-pep517 "pyqt5 (==5.15.2)"
Collecting pyqt5==5.15.2
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/28/6c/640e3f5c734c296a7193079a86842a789edb7988dca39eab44579088a1d1/PyQt5-5.15.2.tar.gz
  Downloading PyQt5-5.15.2.tar.gz (3.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 4.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      Traceback (most recent call last):
        File "C:\Users\nbdhc\AppData\Local\pypoetry\Cache\virtualenvs\jsonrpc-1g8b7oV1-py3.11\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\nbdhc\AppData\Local\pypoetry\Cache\virtualenvs\jsonrpc-1g8b7oV1-py3.11\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nbdhc\AppData\Local\pypoetry\Cache\virtualenvs\jsonrpc-1g8b7oV1-py3.11\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 152, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nbdhc\AppData\Local\Temp\pip-build-env-r_utcu4y\overlay\Lib\site-packages\sipbuild\api.py", line 46, in build_wheel
          project = AbstractProject.bootstrap('wheel',
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\nbdhc\AppData\Local\Temp\pip-build-env-r_utcu4y\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 87, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "C:\Users\nbdhc\AppData\Local\Temp\pip-build-env-r_utcu4y\overlay\Lib\site-packages\sipbuild\project.py", line 586, in setup
          self.apply_user_defaults(tool)
        File "C:\Users\nbdhc\AppData\Local\Temp\pip-wheel-gtrn2jcu\pyqt5_d0e386869adb4ed9bf122a2a8aa3e1c7\project.py", line 63, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "C:\Users\nbdhc\AppData\Local\Temp\pip-build-env-r_utcu4y\overlay\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "C:\Users\nbdhc\AppData\Local\Temp\pip-build-env-r_utcu4y\overlay\Lib\site-packages\sipbuild\project.py", line 237, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "C:\Users\nbdhc\AppData\Local\Temp\pip-build-env-r_utcu4y\overlay\Lib\site-packages\pyqtbuild\builder.py", line 69, in apply_user_defaults
          raise PyProjectOptionException('qmake',
      sipbuild.pyproject.PyProjectOptionException
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

当然,我试过使用

$poetry cache clear --all pypl

但它不起作用。

安装后,我更新如下,但问题仍然存在:pippyproject.toml

pyqt5 = "=5.15.10"
$poetry update
Resolving dependencies... Downloading https://files.pythonhosted.org/packages/66/f5/0a684b2b33b1f1dceaf894d4e8a105f523bb08003f81c89a91e509c5f854/PyQt5_Qt5-5.15.11-py3-none-macosx_10_13_x86_64.whl  99% 
Resolving dependencies... Downloading https://files.pythonhosted.org/packages/66/f5/0a684b2b33b1f1dceaf894d4e8a105f523bb08003f81c89a91e509c5f854/PyQt5_Qt5-5.15.11-py3-none-macosx_10_13_x86_64.whl  99% Resolving dependencies... (43.5s)

Package operations: 0 installs, 1 update, 0 removals

  • Updating pyqt5-qt5 (5.15.2 -> 5.15.11): Failed

  RuntimeError

  Unable to find installation candidates for pyqt5-qt5 (5.15.11)

  at ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\chooser.py:73 in choose_for
       69│
       70│             links.append(link)
       71│
       72│         if not links:
    →  73│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       74│
       75│         # Get the best link
       76│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       77│

Cannot install pyqt5-qt5.

pyqt5 = "=5.15.2"
$poetry update
Updating dependencies
Resolving dependencies... (9.3s)

Package operations: 0 installs, 1 update, 0 removals

  • Downgrading pyqt5 (5.15.10 -> 5.15.2): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  Traceback (most recent call last):
    File "C:\Users\nbdhc\AppData\Roaming\pypoetry\venv\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "C:\Users\nbdhc\AppData\Roaming\pypoetry\venv\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\nbdhc\AppData\Roaming\pypoetry\venv\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpau4hqchz\.venv\Lib\site-packages\sipbuild\api.py", line 46, in build_wheel
      project = AbstractProject.bootstrap('wheel',
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpau4hqchz\.venv\Lib\site-packages\sipbuild\abstract_project.py", line 87, in bootstrap
      project.setup(pyproject, tool, tool_description)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpau4hqchz\.venv\Lib\site-packages\sipbuild\project.py", line 586, in setup
      self.apply_user_defaults(tool)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpdh6v9hcw\PyQt5-5.15.2\project.py", line 63, in apply_user_defaults
      super().apply_user_defaults(tool)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpau4hqchz\.venv\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults
      super().apply_user_defaults(tool)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpau4hqchz\.venv\Lib\site-packages\sipbuild\project.py", line 237, in apply_user_defaults
      self.builder.apply_user_defaults(tool)
    File "C:\Users\nbdhc\AppData\Local\Temp\tmpau4hqchz\.venv\Lib\site-packages\pyqtbuild\builder.py", line 69, in apply_user_defaults
      raise PyProjectOptionException('qmake',
  sipbuild.pyproject.PyProjectOptionException
  

  at ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\chef.py:164 in _prepare
      160│
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│
      163│             if error is not None:
    → 164│                 raise error from None
      165│
      166│             return path
      167│
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pyqt5 (5.15.2) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pyqt5 (==5.15.2)"'.

问题摘要:

目前,我能够使用 成功安装,但是在尝试通过 配置时遇到了问题。这让我思考这个问题的根本原因是否在于我的特定配置、我使用的 Python 版本,还是我可能不知道的设置的某些未知方面。我正在寻找见解或解决方案,以有效解决 和 之间的这种差异。pyqt5pippoetrypoetrypippoetry

其他上下文:

  • pip install pyqt5工作没有任何问题。
  • poetry add pyqt5或导致错误,特别是在查找安装候选项或为 .poetry updatepyqt5
  • 我的环境使用Python 3.11,我尝试过清除缓存并直接在中指定版本。poetrypyproject.toml
  • 无论 中指定的版本如何,该问题仍然存在。pyqt5pyproject.toml

我已经检查了相关文档和其他类似问题,但没有找到解决方案。

有没有人遇到过类似的问题,或者有人对如何解决它有任何建议?

谢谢!

我试过什么:

使用 pip:我使用 pip 成功安装了 pyqt5,没有遇到任何问题。

使用诗歌:

我尝试使用诗歌添加 pyqt5 添加 pyqt5,这导致了与查找安装候选者相关的错误。 运行诗歌更新也导致了类似的问题,特别是为 pyqt5 构建轮子时的错误。 我尝试在pyproject.toml中指定不同版本的pyqt5,但问题仍然存在。 其他尝试:

使用 poetry cache clear --all pypi 清除了 Poetry 的缓存。 已检查并确认网络设置和代理配置。 我期待什么:

我期待诗歌能像 pip 一样顺利地处理 pyqt5 的安装。具体来说,我预计诗歌添加或诗歌更新将成功解决和安装 pyqt5 依赖项而不会遇到错误,特别是因为通过 pip 安装是成功且直接的。

python pip pyqt5 依赖管理 python-poetry

评论


答: 暂无答案