ros-visualization / rqt_reconfigure

http://wiki.ros.org/rqt_reconfigure
Other
23 stars 50 forks source link

Issues with PyQt5 #118

Open Yadunund opened 2 years ago

Yadunund commented 2 years ago

I'm on an Ubuntu 20.04 system with galactic binary of this package version 1.0.8-1focal.20220430.131618

Running ros2 run rqt_reconfigure rqt_reconfigure throws the following exception

Traceback (most recent call last):
  File "/opt/ros/galactic/lib/rqt_reconfigure/rqt_reconfigure", line 11, in <module>
    load_entry_point('rqt-reconfigure==1.0.8', 'console_scripts', 'rqt_reconfigure')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/opt/ros/galactic/lib/python3.8/site-packages/rqt_reconfigure/__main__.py", line 36, in <module>
    from rqt_reconfigure.param_plugin import ParamPlugin
  File "/opt/ros/galactic/lib/python3.8/site-packages/rqt_reconfigure/param_plugin.py", line 35, in <module>
    from rqt_gui_py.plugin import Plugin
  File "/opt/ros/galactic/lib/python3.8/site-packages/rqt_gui_py/plugin.py", line 33, in <module>
    from qt_gui.plugin import Plugin as Base
  File "/opt/ros/galactic/lib/python3.8/site-packages/qt_gui/plugin.py", line 31, in <module>
    from python_qt_binding.QtCore import QObject
  File "/opt/ros/galactic/lib/python3.8/site-packages/python_qt_binding/__init__.py", line 56, in <module>
    from python_qt_binding.binding_helper import loadUi  # noqa: F401
  File "/opt/ros/galactic/lib/python3.8/site-packages/python_qt_binding/binding_helper.py", line 277, in <module>
    _select_qt_binding(
  File "/opt/ros/galactic/lib/python3.8/site-packages/python_qt_binding/binding_helper.py", line 108, in _select_qt_binding
    QT_BINDING_VERSION = binding_loader(required_modules, optional_modules)
  File "/opt/ros/galactic/lib/python3.8/site-packages/python_qt_binding/binding_helper.py", line 155, in _load_pyqt
    _named_optional_import('PyQt5.%s' % module_name)
  File "/opt/ros/galactic/lib/python3.8/site-packages/python_qt_binding/binding_helper.py", line 142, in _named_optional_import
    _named_import(name)
  File "/opt/ros/galactic/lib/python3.8/site-packages/python_qt_binding/binding_helper.py", line 133, in _named_import
    module = builtins.__import__(name)
ValueError: PyCapsule_GetPointer called with incorrect name

From what I understand this is due to having a mismatch in the PyQt5 version on my system. So I manually installed PyQt5-5.10.1 with python3 -m pip install PyQt5==5.10.1.

Then upon launching, I get this error below

Could not import "pyqt" bindings of qt_gui_cpp library - so C++ plugins will not be available:
Traceback (most recent call last):
  File "/opt/ros/galactic/lib/python3.8/site-packages/qt_gui_cpp/cpp_binding_helper.py", line 43, in <module>
    from . import libqt_gui_cpp_sip
ImportError: /home/yadu/.local/lib/python3.8/site-packages/PyQt5/Qt/lib/libQt5Core.so.5: version `Qt_5.12' not found (required by /opt/ros/galactic/lib/python3.8/site-packages/qt_gui_cpp/libqt_gui_cpp_sip.so)

Then I installed python3 -m pip install PyQt5==5.12 following the hint from the ImportError. But now I'm experiencing

RosPluginProvider.load(qt_gui_cpp/CppPluginProvider) exception raised in __builtin__.__import__(qt_gui_cpp.cpp_plugin_provider, [CppPluginProvider]):
Traceback (most recent call last):
  File "/opt/ros/galactic/lib/python3.8/site-packages/rqt_gui/ros_plugin_provider.py", line 80, in load
    module = __builtin__.__import__(
  File "/opt/ros/galactic/lib/python3.8/site-packages/qt_gui_cpp/cpp_plugin_provider.py", line 33, in <module>
    from .cpp_binding_helper import qt_gui_cpp
  File "/opt/ros/galactic/lib/python3.8/site-packages/qt_gui_cpp/cpp_binding_helper.py", line 43, in <module>
    from . import libqt_gui_cpp_sip
ValueError: PyCapsule_GetPointer called with incorrect name

RecursivePluginProvider.discover() loading plugin "qt_gui_cpp/CppPluginProvider" failed:
Traceback (most recent call last):
  File "/opt/ros/galactic/lib/python3.8/site-packages/qt_gui/recursive_plugin_provider.py", line 60, in discover
    instance = self._plugin_provider.load(plugin_descriptor.plugin_id(), None)
  File "/opt/ros/galactic/lib/python3.8/site-packages/rqt_gui/ros_plugin_provider.py", line 91, in load
    raise e
  File "/opt/ros/galactic/lib/python3.8/site-packages/rqt_gui/ros_plugin_provider.py", line 80, in load
    module = __builtin__.__import__(
  File "/opt/ros/galactic/lib/python3.8/site-packages/qt_gui_cpp/cpp_plugin_provider.py", line 33, in <module>
    from .cpp_binding_helper import qt_gui_cpp
  File "/opt/ros/galactic/lib/python3.8/site-packages/qt_gui_cpp/cpp_binding_helper.py", line 43, in <module>
    from . import libqt_gui_cpp_sip
ValueError: PyCapsule_GetPointer called with incorrect name

What am I missing?

bmaxdk commented 1 year ago

I think there is mismatch between the PyQt5 version and the bindings used in ROS. Since you have manually installed specific versions of PyQt5, it might be helpful to remove those first to avoid potential conflicts. And then install ros-compatible pyqt5. Try remove and reinstall rqt_reconfigure.

$ python3 -m pip uninstall PyQt5
$ sudo apt-get install python3-pyqt5
$ sudo apt-get purge ros-galactic-rqt-reconfigure
$ sudo apt-get install ros-galactic-rqt-reconfigure

I think at least this issue resolve the incorrect version of the package or dependencies?..

Hope this works