Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11 support #108

Closed
liudonghua123 opened this issue Nov 28, 2022 · 7 comments
Closed

Python 3.11 support #108

liudonghua123 opened this issue Nov 28, 2022 · 7 comments

Comments

@liudonghua123
Copy link

liudonghua123 commented Nov 28, 2022

I update my python to 3.11 recently, now I try to install pyqt5 and pyqt5-tools. The pyqt5 installation is success, but pyqt5-tools is failed with the the similar errors when I install on python 3.10.

So I tried the same workaround I commented on #98 (comment) which I used on python 3.10.

wget https://files.pythonhosted.org/packages/5e/1b/5edc9b05c33d75f9cea3159ae3d1ff11369a0afe84eddaf5b3974b0769d1/pyqt5_plugins-5.15.4.2.2-cp39-cp39-win_amd64.whl
mv pyqt5_plugins-5.15.4.2.2-cp39-cp39-win_amd64.whl pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl
pip install pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl

But it failed with the following errors.

pip install D:\Downloads\pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl
C:\Users\Liu.D.H>python -V
Python 3.11.0

C:\Users\Liu.D.H>pip -V
pip 22.3.1 from C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)

C:\Users\Liu.D.H>
C:\Users\Liu.D.H>pip install pyqt5
Requirement already satisfied: pyqt5 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (5.15.7)
Requirement already satisfied: PyQt5-sip<13,>=12.11 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt5) (12.11.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.0 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt5) (5.15.2)

C:\Users\Liu.D.H>
C:\Users\Liu.D.H>pip install D:\Downloads\pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl
Processing d:\downloads\pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl
Requirement already satisfied: click in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt5-plugins==5.15.4.2.2) (8.1.3)
Collecting pyqt5==5.15.4
  Using cached PyQt5-5.15.4.tar.gz (3.3 MB)
  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
  ╰─> [33 lines of output]
      Traceback (most recent call last):
        File "C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 144, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
          main()
        File "C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 148, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Liu.D.H\AppData\Local\Temp\pip-build-env-118b00b5\overlay\Lib\site-packages\sipbuild\api.py", line 46, in build_wheel
          project = AbstractProject.bootstrap('wheel',
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Liu.D.H\AppData\Local\Temp\pip-build-env-118b00b5\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 87, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "C:\Users\Liu.D.H\AppData\Local\Temp\pip-build-env-118b00b5\overlay\Lib\site-packages\sipbuild\project.py", line 585, in setup
          self.apply_user_defaults(tool)
        File "C:\Users\Liu.D.H\AppData\Local\Temp\pip-install-af21yb96\pyqt5_95b94776b0bf4a33ab12b7eb411b877f\project.py", line 63, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "C:\Users\Liu.D.H\AppData\Local\Temp\pip-build-env-118b00b5\overlay\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "C:\Users\Liu.D.H\AppData\Local\Temp\pip-build-env-118b00b5\overlay\Lib\site-packages\sipbuild\project.py", line 236, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "C:\Users\Liu.D.H\AppData\Local\Temp\pip-build-env-118b00b5\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.

C:\Users\Liu.D.H>

I have to overwrite Requires-Dist: pyqt5 section from Requires-Dist: pyqt5 (==5.15.4) to Requires-Dist: pyqt5 in pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl/pyqt5_plugins-5.15.4.2.2.dist-info/METADATA.

Then install again, I can install pyqt5-tools successfully now.

pip install D:\Downloads\pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl
C:\Users\Liu.D.H>pip install D:\Downloads\pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl
Processing d:\downloads\pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.whl
Requirement already satisfied: click in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt5-plugins==5.15.4.2.2) (8.1.3)
Requirement already satisfied: pyqt5 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt5-plugins==5.15.4.2.2) (5.15.7)
Collecting qt5-tools<5.15.2.2,>=5.15.2.1.2
  Downloading qt5_tools-5.15.2.1.2-py3-none-any.whl (13 kB)
Collecting qt5-applications<5.15.2.3,>=5.15.2.2.2
  Downloading qt5_applications-5.15.2.2.2-py3-none-win_amd64.whl (60.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.9/60.9 MB 8.8 MB/s eta 0:00:00
Collecting click
  Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.8/82.8 kB 1.2 MB/s eta 0:00:00
Requirement already satisfied: PyQt5-sip<13,>=12.11 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt5->pyqt5-plugins==5.15.4.2.2) (12.11.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.0 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt5->pyqt5-plugins==5.15.4.2.2) (5.15.2)
Installing collected packages: qt5-applications, click, qt5-tools, pyqt5-plugins
  Attempting uninstall: click
    Found existing installation: click 8.1.3
    Uninstalling click-8.1.3:
      Successfully uninstalled click-8.1.3
Successfully installed click-7.1.2 pyqt5-plugins-5.15.4.2.2 qt5-applications-5.15.2.2.2 qt5-tools-5.15.2.1.2

C:\Users\Liu.D.H>qt5-tools
Usage: qt5-tools [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  assistant
  canbusutil
  designer
  lconvert
  licheck64
  linguist
  lprodump
  lrelease
  lrelease-pro
  lupdate
  lupdate-pro
  moc
  pixeltool
  qcollectiongenerator
  qdbus
  qdbuscpp2xml
  qdbusviewer
  qdbusxml2cpp
  qdistancefieldgenerator
  qdoc
  qgltf
  qhelpgenerator
  qlalr
  qmake
  qml
  qmlcachegen
  qmleasing
  qmlformat
  qmlimportscanner
  qmllint
  qmlmin
  qmlplugindump
  qmlpreview
  qmlprofiler
  qmlscene
  qmltestrunner
  qmltyperegistrar
  qscxmlc
  qtattributionsscanner
  qtdiag
  qtpaths
  qtplugininfo
  qtwaylandscanner
  qvkgen
  rcc
  repc
  sdpscanner
  tracegen
  uic
  xmlpatterns
  xmlpatternsvalidator

C:\Users\Liu.D.H>qt5-tools designer

C:\Users\Liu.D.H>

pyqt5_plugins-5.15.4.2.2-py3-none-win_amd64.zip

@liudonghua123 liudonghua123 changed the title Python 3.11 support Python 3.11 support for pyqt5-tools Nov 28, 2022
@liudonghua123
Copy link
Author

liudonghua123 commented Nov 28, 2022

I tried the same workaround for pyqt6-tools.

wget https://files.pythonhosted.org/packages/59/42/c5d942af97f9792a32029aca02055bce00d3b454be30a432bfb38a647a95/pyqt6_plugins-6.1.0.2.2-cp39-cp39-win_amd64.whl
mv pyqt6_plugins-6.1.0.2.2-cp39-cp39-win_amd64.whl pyqt6_plugins-6.1.0.2.2-py3-none-win_amd64.whl
# overwrite `Requires-Dist: pyqt6` section from `Requires-Dist: pyqt6 (==6.1.0)` to `Requires-Dist: pyqt6` and `Requires-Dist: qt6-tools` section from `Requires-Dist: qt6-tools (<6.1.0.2,>=6.1.0.1.2)` to `Requires-Dist: qt6-tools` in pyqt6_plugins-6.1.0.2.2-py3-none-win_amd64.whl/pyqt6_plugins-6.1.0.2.2.dist-info/METADATA.
pip install pyqt6_plugins-6.1.0.2.2-py3-none-win_amd64.whl
wget https://files.pythonhosted.org/packages/d0/5a/125c5c43772d4d94554e9c31ccca9645c5e69f1c7aba4e43d5b427dc4d42/pyqt6_tools-6.1.0.3.2-py3-none-any.whl
# change `Requires-Dist: pyqt6 (==6.1.0)` to `Requires-Dist: pyqt6` and `Requires-Dist: pyqt6-plugins (<6.1.0.3,>=6.1.0.2.2)` to `Requires-Dist: pyqt6-plugins` (remove the version limit for pyqt6 and pyqt6-plugins) in pyqt6_tools-6.1.0.3.2-py3-none-any.whl/pyqt6_tools-6.1.0.3.2.dist-info/METADATA
pip install pyqt6_tools-6.1.0.3.2-py3-none-any.whl
C:\Users\Liu.D.H>python -V
Python 3.11.0

C:\Users\Liu.D.H>pip -V
pip 22.3.1 from C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)

C:\Users\Liu.D.H>pip install pyqt6
Collecting pyqt6
  Downloading PyQt6-6.4.0-cp37-abi3-win_amd64.whl (6.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 8.9 MB/s eta 0:00:00
Collecting PyQt6-sip<14,>=13.4
  Downloading PyQt6_sip-13.4.0-cp311-cp311-win_amd64.whl (72 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 72.6/72.6 kB 4.2 MB/s eta 0:00:00
Collecting PyQt6-Qt6>=6.4.0
  Downloading PyQt6_Qt6-6.4.1-py3-none-win_amd64.whl (50.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 50.5/50.5 MB 9.2 MB/s eta 0:00:00
Installing collected packages: PyQt6-Qt6, PyQt6-sip, pyqt6
Successfully installed PyQt6-Qt6-6.4.1 PyQt6-sip-13.4.0 pyqt6-6.4.0

C:\Users\Liu.D.H>pip install D:\Downloads\pyqt6_plugins-6.1.0.2.2-py3-none-win_amd64.whl
Processing d:\downloads\pyqt6_plugins-6.1.0.2.2-py3-none-win_amd64.whl
Requirement already satisfied: click in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6-plugins==6.1.0.2.2) (7.1.2)
Requirement already satisfied: pyqt6 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6-plugins==6.1.0.2.2) (6.4.0)
Collecting qt6-tools
  Downloading qt6_tools-6.1.0.1.2-py3-none-any.whl (13 kB)
Requirement already satisfied: PyQt6-sip<14,>=13.4 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6->pyqt6-plugins==6.1.0.2.2) (13.4.0)
Requirement already satisfied: PyQt6-Qt6>=6.4.0 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6->pyqt6-plugins==6.1.0.2.2) (6.4.1)
Collecting qt6-applications<6.1.0.3,>=6.1.0.2.2
  Downloading qt6_applications-6.1.0.2.2-py3-none-win_amd64.whl (60.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.4/60.4 MB 9.1 MB/s eta 0:00:00
Installing collected packages: qt6-applications, qt6-tools, pyqt6-plugins
Successfully installed pyqt6-plugins-6.1.0.2.2 qt6-applications-6.1.0.2.2 qt6-tools-6.1.0.1.2

C:\Users\Liu.D.H>pip install pyqt6-tools
Collecting pyqt6-tools
  Downloading pyqt6_tools-6.1.0.3.2-py3-none-any.whl (29 kB)
Requirement already satisfied: click in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6-tools) (7.1.2)
Collecting pyqt6==6.1.0
  Downloading PyQt6-6.1.0.tar.gz (946 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 946.9/946.9 kB 2.9 MB/s eta 0:00:00
  Installing build dependencies ... canceled
ERROR: Operation cancelled by user

C:\Users\Liu.D.H>pip install D:\Downloads\pyqt6_tools-6.1.0.3.2-py3-none-any.whl
Processing d:\downloads\pyqt6_tools-6.1.0.3.2-py3-none-any.whl
Requirement already satisfied: click in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6-tools==6.1.0.3.2) (7.1.2)
Requirement already satisfied: pyqt6 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6-tools==6.1.0.3.2) (6.4.0)
Requirement already satisfied: pyqt6-plugins in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6-tools==6.1.0.3.2) (6.1.0.2.2)
Requirement already satisfied: python-dotenv in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6-tools==6.1.0.3.2) (0.21.0)
Requirement already satisfied: PyQt6-sip<14,>=13.4 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6->pyqt6-tools==6.1.0.3.2) (13.4.0)
Requirement already satisfied: PyQt6-Qt6>=6.4.0 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6->pyqt6-tools==6.1.0.3.2) (6.4.1)
Requirement already satisfied: qt6-tools in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from pyqt6-plugins->pyqt6-tools==6.1.0.3.2) (6.1.0.1.2)
Requirement already satisfied: qt6-applications<6.1.0.3,>=6.1.0.2.2 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from qt6-tools->pyqt6-plugins->pyqt6-tools==6.1.0.3.2) (6.1.0.2.2)
Installing collected packages: pyqt6-tools
Successfully installed pyqt6-tools-6.1.0.3.2

C:\Users\Liu.D.H>python -c "import PyQt6"

C:\Users\Liu.D.H>

pyqt6_tools-py3-none-win_amd64.zip

@liudonghua123 liudonghua123 changed the title Python 3.11 support for pyqt5-tools Python 3.11 support Nov 28, 2022
@randytbushman
Copy link

Same issue here!

@daniel9184
Copy link

daniel9184 commented Feb 1, 2023

Thanks a lot! After changing the "Requires-Dist: pyqt6 (==6.1.0)" to only "Requires-Dist: pyqt6" on the metadata, it worked for pyqt6 on python 3.11!

@Baboomba
Copy link

Thank you, it works well!

I regret that current developer doesn't use this library. It doesn't make update properly.

@altendky
Copy link
Owner

I'm trying to make it to a new release. #110

But yes, libraries maintained by people that don't use them aren't great. At least not when they tend to hit all sorts of goofy corner cases when new versions of three major dependencies come out. (Python, PyQt, and Qt) Having other people step up and add CI coverage for new dependency releases and then debug and fix them would be a great help.

Anyways, sorry for the hassle all. Hopefully this time I actually manage to get all the way to a release.

Also, if you don't need the plugins and just want the qt applications, consider the qt5-tools and qt6-tools packages that aren't dependent on PyQt and are also not specific to any Python 3 version.

@altendky
Copy link
Owner

Though yes, even those are behind and not providing the latest Qt application versions.

@altendky
Copy link
Owner

Hey all, this is a common note I'm adding to several issues.

I apologize for the hassle you have all dealt with around this project. I don't work with Qt anymore and every time I've come back to this I have run into various problems trying to get it going again. This time I made it through the five days of work to get the release out (fingers crossed that it actually works). It would be great to get some community involvement around updating and debugging whatever issues come up. Maybe the next Python, Qt, or PyQt release will provide an opportunity for someone to offer that. Maybe I'll find time to continue cleaning this up so it's a bit more maintainable. If interested, there's been some discussion about the project at #110.

In an effort to make it easier to monitor issues around the latest release I am closing this issue. Discussion can continue if still applicable, but I want to make it easier to move forward. If there are issues with the new releases, please open new issues.

Things to be aware of that may ease some cases:

  • If you just want the Qt applications, you can directly use qt-tools which provides helpers around qt-applications. This skips the PyQt specific layers. You won't have access to the plugins, such as for showing custom PyQt Designer widget plugins in Designer, but you also won't have the hassle of needing a version matching your PyQt version. At least not quite as closely.
  • If I once again fail to maintain this, or you just want a specific version I didn't include, you can set environment variables to select the versions when building. PYQT_VERSION=6.5.0 QT_VERSION=6.5.2 venv/bin/pip install git+https://github.com/altendky/[email protected] for example would try to build and install qt-applications v2.3 including (a theoretical future) PyQt version 6.5.0 and Qt 6.5.2. I'm sure there are corners around this, but it would be relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants