Plastic-Scanner / PSplot

A lightweight tool for obtaining and visualising the discrete near-infrared (NIR) data using the Plastic Scanner
GNU General Public License v3.0
7 stars 5 forks source link

PyQt6 is broken on Python 3.9? #14

Closed pranavb104 closed 2 years ago

pranavb104 commented 2 years ago

So, I was trying to install this tool on my RPI 3B+ running Raspbian 11(bullseye). Since it already comes installed with Python 3.9, I decided to just use the default build instead of building Python3.8(or greater) from source.

The pipenv install commands fails due to pyqt6 issue(after changing dependency to Python3.9). The log from pip install pyqt6 is as follows:

pi@raspberrypi:~/PSplot $ pip install pyqt6
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyqt6
  Using cached PyQt6-6.3.0.tar.gz (1.0 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
  ╰─> [29 lines of output]
      Traceback (most recent call last):
        File "/home/pi/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, 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 "/home/pi/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/pi/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/pi/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/tmp/pip-build-env-fhev88a7/overlay/lib/python3.9/site-packages/sipbuild/api.py", line 51, in build_wheel
          project = AbstractProject.bootstrap('pep517')
        File "/tmp/pip-build-env-fhev88a7/overlay/lib/python3.9/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/tmp/pip-build-env-fhev88a7/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 594, in setup
          self.apply_user_defaults(tool)
        File "project.py", line 67, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-fhev88a7/overlay/lib/python3.9/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-fhev88a7/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 241, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "/tmp/pip-build-env-fhev88a7/overlay/lib/python3.9/site-packages/pyqtbuild/builder.py", line 67, 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.

For now, I've switched to pyqt5 using this command to install : sudo apt-get install python3-pyqt5 . And it works fine. I think this is an internal problem with pyqt6 since it is relatively new and needs some patchwork before it is a stable build.

jurc192 commented 2 years ago

I believe that the difference between Python 3.8 and 3.9 should not matter too much. Perhaps you can try using pipenv (isolated python environment) for installing dependencies and running the code - since in the command above you are installing PyQt6 systemwide. Is the problem the same on desktop Ubuntu/Debian? If more people have problems with PyQt6 I will look into it, but in general I would prefer to stick to new(est) versions of libraries as much as possible

jurc192 commented 2 years ago

I tested using Python 3.9 + PyQt6 on my system (Arch Linux, x86) and it works fine. Closing this issue for now, but we can figure out RPi support on a separate issue or discord if you can't get it to work