ros-visualization / python_qt_binding

http://wiki.ros.org/python_qt_binding
BSD 3-Clause "New" or "Revised" License
34 stars 54 forks source link

if python2 with Qt4 and python3 with PyQt5 are installed, python2 is choosen #35

Closed simonschmeisser closed 8 years ago

simonschmeisser commented 8 years ago

I'm not sure if this is the right place but I want to report it somewhere ...

On Ubuntu Trusty 14.04, PyQt4 is available for python 2.7 (the default), while PyQt5 is only available for python 3.4 (package python3-pyqt5).

Since the default python version is used, no pyqt5 package is found

[ 62%] Running SIP generator for rviz_sip Python bindings... Traceback (most recent call last): File "/home/ros/ros_upstream/src/python_qt_binding/cmake/sip_configure.py", line 8, in from PyQt5 import QtCore ImportError: No module named PyQt5

dirk-thomas commented 8 years ago

On Trusty (which is targeted by ROS Indigo and Jade) we only support Qt 4. The code for these releases is on the groovy-devel branch.

As of the upcoming ROS Kinetic release this package supports only Qt 5. That is the code on the default branch (kinetic-devel). But ROS Kinetic will still use Python 2.7 and PyQt 5 is available for Python 2 in the newer Ubuntu distros: http://packages.ubuntu.com/xenial/python-pyqt5

tngan commented 7 years ago

@dirk-thomas I have similar problem. I am in ROS kinetic (Ubuntu 16.04) and have already installed python-pyqt5. When I run rqt_reconfigure, the following error is shown.

Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/rqt_reconfigure/rqt_reconfigure", line 6, in <module>
    from rqt_reconfigure.param_plugin import ParamPlugin
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_reconfigure/param_plugin.py", line 35, in <module>
    from rqt_gui_py.plugin import Plugin
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_gui_py/plugin.py", line 33, in <module>
    from qt_gui.plugin import Plugin as Base
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/qt_gui/plugin.py", line 31, in <module>
    from python_qt_binding.QtCore import QObject
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/__init__.py", line 55, in <module>
    from .binding_helper import loadUi, QT_BINDING, QT_BINDING_MODULES, QT_BINDING_VERSION  # @UnusedImport
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 252, in <module>
    getattr(sys, 'SELECT_QT_BINDING_ORDER', None),
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 98, in _select_qt_binding
    raise ImportError("Could not find Qt binding (looked for: %s):\n%s" % (', '.join(["'%s'" % b for b in binding_order]), '\n'.join(error_msgs)))
ImportError: Could not find Qt binding (looked for: 'pyqt', 'pyside'):
  ImportError for 'pyqt': No module named QtCore
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 89, in _select_qt_binding
    QT_BINDING_VERSION = binding_loader(required_modules, optional_modules)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 131, in _load_pyqt
    _named_import('PyQt5.%s' % module_name)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 111, in _named_import
    module = builtins.__import__(name)
ImportError: No module named QtCore

  ImportError for 'pyside': No module named QtCore
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 89, in _select_qt_binding
    QT_BINDING_VERSION = binding_loader(required_modules, optional_modules)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 163, in _load_pyside
    _named_import('PySide2.%s' % module_name)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 111, in _named_import
    module = builtins.__import__(name)
ImportError: No module named QtCore
dirk-thomas commented 7 years ago

@tngan Have you tried using PyQt5 without rqt? Maybe try to run the following to see if it is installed correctly: python -c "from PyQt5 import QtCore"

Since your question is different from the original ticket you might want to ask it in answers.org instead for a higher chance of people answering it.