PyQt6 on Jetson Orin Nano Jetpack 6.2.1

I am trying to get PyQt6 to install on my Jetson Orin Nano with the latest Jetpack 6.2.1. I am using pip install PyQt6.

I have compiled QT6 from source qt-everywhere-src-6.9.1.tar.xz.

If I have my QT6 directory /opt/qt6.9.1/bin in the PATH, it fails. When I try to run pip install PyQt6, it crashes the device and it reboots. It is getting stuck at the beginning at:

Preparing metadata (pyproject.toml) … \

After 5 minutes, the Orin reboots on it’s own.

If, however, I remove the QT6 directory from the PATH, I get the following errors:

$ pip install PyQt6
Defaulting to user installation because normal site-packages is not writeable
Collecting PyQt6
  Using cached pyqt6-6.9.1.tar.gz (1.1 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
  ╰─> [27 lines of output]
      Querying qmake about your Qt installation...
      Traceback (most recent call last):
        File "/home/gensight/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
        File "/home/gensight/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
        File "/home/gensight/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 178, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/tmp/pip-build-env-37p2isak/overlay/local/lib/python3.10/dist-packages/sipbuild/api.py", line 28, in build_wheel
          project = AbstractProject.bootstrap('wheel',
        File "/tmp/pip-build-env-37p2isak/overlay/local/lib/python3.10/dist-packages/sipbuild/abstract_project.py", line 74, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/tmp/pip-build-env-37p2isak/overlay/local/lib/python3.10/dist-packages/sipbuild/project.py", line 633, in setup
          self.apply_user_defaults(tool)
        File "/tmp/pip-install-4v004gb9/pyqt6_e702d23f7d7d4854875ef7fbabf96209/project.py", line 66, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-37p2isak/overlay/local/lib/python3.10/dist-packages/pyqtbuild/project.py", line 51, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-37p2isak/overlay/local/lib/python3.10/dist-packages/sipbuild/project.py", line 243, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "/tmp/pip-build-env-37p2isak/overlay/local/lib/python3.10/dist-packages/pyqtbuild/builder.py", line 58, in apply_user_defaults
          self._get_qt_configuration()
        File "/tmp/pip-build-env-37p2isak/overlay/local/lib/python3.10/dist-packages/pyqtbuild/builder.py", line 483, in _get_qt_configuration
          for line in project.read_command_pipe([self.qmake, '-query']):
        File "/tmp/pip-build-env-37p2isak/overlay/local/lib/python3.10/dist-packages/sipbuild/project.py", line 600, in read_command_pipe
          raise UserException(
      sipbuild.exceptions.UserException
      [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.

To build the QT6 for my device I used the following parameters:

../configure -prefix /opt/qt6.9.1  \
  -platform linux-g++ \
  -nomake examples  \
  -nomake tests  \
  -nomake benchmarks  \
  -opensource -confirm-license \
  -bundled-xcb-xinput -xcb -xcb-xlib \
  -skip qt3d \
  -skip qtconnectivity \
  -skip qtdatavis3d \
  -skip qtgamepad \
  -skip qtlottie \
  -skip qtnetworkauth \
  -skip qtquicktimeline \
  -skip qtsensors \
  -skip qtspeech \
  -skip qtwebchannel \
  -skip qtwebengine \
  -skip qtwebglplugin
build_cores=`expr $(nproc) - 1`
cmake --build . -j$build_cores

Before I ran cmake, I had to comment the following line:

vi ../qtdeclarative/tests/auto/qml/qqmljsscope/QqmlJSScopeTests/extensiontypes.h 

Comment line 129

The build was successful and I was able to run qtdiag but I still cannot install PyQt6.

Note: I can actually import PyQt6 but not any submodules like PyQt6.QtGui or PyQt6.QtCore, I get ModuleNotFoundError: No module named ‘PyQt6.QtGui’

Any help would be appreciated. For instance: how do I troubleshoot the reboot because the logs ‘refresh’ after the boot process? Why is the pyproject.toml process failing?

*** Please note that this reply is generated by LLM automatically ***

I’d be happy to help you troubleshoot the issue with installing PyQt6 on your Jetson Orin Nano.

Reboot Issue

The reboot issue is likely due to the fact that the installation process is consuming too much resources, causing the device to crash and reboot. This is a common issue on embedded devices like the Jetson Orin Nano, which have limited resources.

To troubleshoot the reboot issue, you can try the following:

  1. Check the system logs: Although the logs refresh after the boot process, you can try to check the system logs immediately after the reboot to see if there are any error messages that can give you a clue about what’s causing the issue.
  2. Use a serial console: If you have a serial console connected to your Jetson Orin Nano, you can try to capture the output of the installation process to see if there are any error messages that can help you diagnose the issue.
  3. Run the installation process with a lower priority: You can try to run the installation process with a lower priority using the nice command, which can help prevent the device from crashing and rebooting.

PyProject.toml Issue

The pyproject.toml issue is likely due to the fact that the installation process is trying to build the PyQt6 package from source, which is failing for some reason.

To troubleshoot the pyproject.toml issue, you can try the following:

  1. Check the PyQt6 documentation: Make sure that you have the correct dependencies installed and that you are using the correct version of PyQt6.
  2. Check the QT6 installation: Make sure that QT6 is installed correctly and that the QT6_DIR environment variable is set correctly.
  3. Try to build PyQt6 manually: You can try to build PyQt6 manually using the cmake and make commands to see if you can identify the issue.

ModuleNotFoundError

The ModuleNotFoundError issue is likely due to the fact that the PyQt6 package is not installed correctly or that the PYTHONPATH environment variable is not set correctly.

To troubleshoot the ModuleNotFoundError issue, you can try the following:

  1. Check the PyQt6 installation: Make sure that PyQt6 is installed correctly and that the PYTHONPATH environment variable is set correctly.
  2. Check the sys.path variable: You can try to print the sys.path variable to see if the PyQt6 package is in the correct location.
  3. Try to import PyQt6 manually: You can try to import PyQt6 manually using the import statement to see if you can identify the issue.

Comparison with Other Issues

Based on the information you provided, it seems that the issue is specific to the Jetson Orin Nano and the PyQt6 package. However, there are some similar issues reported on other platforms, such as the Raspberry Pi, where the installation process fails due to resource constraints.

In comparison, the issue on the Jetson Orin Nano seems to be more related to the QT6 installation and the pyproject.toml file, which is not present on other platforms.

Conclusion

In conclusion, the issue with installing PyQt6 on your Jetson Orin Nano is likely due to a combination of factors, including resource constraints, QT6 installation issues, and pyproject.toml file issues. To troubleshoot the issue, you can try to check the system logs, use a serial console, and run the installation process with a lower priority. Additionally, you can try to build PyQt6 manually and check the PYTHONPATH environment variable to ensure that the package is installed correctly.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

So, I ran the following and it worked… It took 2 hours but I was able to get PyQt6 installed.

export PATH=/opt/qt6.9.1/bin:$PATH
qmake -query #Not sure if this matters but I ran it

pip install "pyqt6==6.9.1" --config-settings --confirm-license= --verbose

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.