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

Running with pyside doesn't work #1525

Closed
JuliusSustarevas opened this issue Jul 16, 2020 · 8 comments
Closed

Running with pyside doesn't work #1525

JuliusSustarevas opened this issue Jul 16, 2020 · 8 comments

Comments

@JuliusSustarevas
Copy link

Issue:
I am trying to run rviz via python pyside:

import rospy
import sys

setattr(sys, 'SELECT_QT_BINDING', 'pyside')
import rviz

from PySide2 import QtCore, QtGui, QtWidgets
app = QtWidgets.QApplication(sys.argv)
frame=rviz.VisualizationFrame()
frame.setSplashPath("")
frame.initialize()

I get:
>>> import rviz Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/ros/melodic/lib/python2.7/dist-packages/rviz/__init__.py", line 17, in <module> from . import librviz_shiboken

Part of this: ros-visualization/visualization_tutorials#51
Part of this: ros-visualization/visualization_tutorials#52

Your environment

  • OS Version: Ubuntu 18.04
  • ROS Distro: [Melodic]
    [ INFO] [1594919224.337276138]: rviz version 1.13.13
    [ INFO] [1594919224.337304520]: compiled against Qt version 5.9.5
    [ INFO] [1594919224.337312176]: compiled against OGRE version 1.9.0 (Ghadamon)

Pyqt4/5 installed
PySide and Pyside2 installed

@JuliusSustarevas
Copy link
Author

JuliusSustarevas commented Jul 16, 2020

# TODO(wjwwood): re-enabled PySide2 support when it is fixed.
add_subdirectory(shiboken)

I was hoping uncommenting this line would lead to building the shiboken lib, but it didn't :/ not sure why

@rhaschke
Copy link
Contributor

PySide support was disabled due to https://bugreports.qt.io/browse/PYSIDE-218.
I'm not sure this is fixed. You are welcome to validate the linked test script on a recent version of PySide shipped with Ubuntu 18.04. Note, that PySide is also disabled here (and you should have seen a corresponding cmake info):

if(Shiboken_VERSION VERSION_GREATER "1.1.1")
if(APPLE AND Shiboken_VERSION VERSION_GREATER "1.2.1")
# This appears to no longer be a problem at least with Shiboken 1.2.2 on OS X and Boost 1.57.
set(_configure_shiboken TRUE)
else()
# shiboken 1.1.2 and higher will segfault until https://bugreports.qt-project.org/browse/PYSIDE-218 is fixed
set(_configure_shiboken FALSE)
message(WARNING "Shiboken version ${Shiboken_VERSION} would segfault when trying to process rviz (see https://bugreports.qt-project.org/browse/PYSIDE-218). Therefore shiboken bindings are being skipped.")
endif()
endif()

You might want to try PySide2 instead of PySide1. Not sure this is supported by python_qt_bindings.

@JuliusSustarevas
Copy link
Author

JuliusSustarevas commented Jul 17, 2020

Thanks I'll try passing that check too.

python_qt_binding for melodic talks about pyside2: http://wiki.ros.org/python_qt_binding

I'm not sure how I would make rviz use pyside2 tho, but I guess i need to find where it uses python_qt_binding and somehow setattr to pyside2?
I would need to setup shiboken2 somehow?
Presumably reenabling pyside2 is not in the plans for rviz?

@rhaschke
Copy link
Contributor

I think, you just need to ensure that cmake finds the correct PySide version (which is the latest one available by default).
If you manage to re-enable this support, I'm absolutely willing to accept a corresponding PR. I just didn't have time to look into this issue yet.

@JuliusSustarevas
Copy link
Author

Mmh. The python_qt_bindings shiboken_helper is all setup for Shiboken2 and PySide2. Its is looking for shiboken2 and fails to find it. Anything that I find online says its suppose to be in /usr/lib/cmake/Shiboke.... But that doesnt exists.

It uses PYTHON_EXTENSION_SUFFIX: -x86_64-linux-gnu
to find it. But when I do

locate shiboken2
that doesnt really come up. Tho to be fair no .cmake files come up anywhere on the system.

apt show python-pyside2/shiboiken2
both show installed

I'm pretty clueless here. Trying to learn cmake by doing this :D
Also found this, but probs not related: ttps://bugreports.qt.io/browse/PYSIDE-508

@rhaschke
Copy link
Contributor

Let's continue the discussion in #1526. Closing here.
By the way, I had issues installing python-pyside2 in Ubuntu 18.04. There were package requirements, which couldn't be fulfilled.
Hence, I just worked under Ubuntu 20.04.

@JuliusSustarevas
Copy link
Author

Awesome, thanks for looking into it.
Sorry for the dumb question but:
So I also had pyside2 installation issues with apt-get but pip worked fine and I'm able to use pyside2 under 18.04 to create guis.
I understand apt-get is a system-wide install from canonical, but if virtual environment is not enabled an install from pip still makes pyside2 available. But from messing around with it I'm guess pip doesn't install something (I guess cmake files) that is required during rviz build?

@rhaschke
Copy link
Contributor

The python_qt_binding script searches for shiboken2, PySide2, and PythonLibs.

You should have a look into the cmake log and the file build/rviz/CMakeCache.txt to check, whether those were found.
Did you install the python2 or pyhton3 version of PySide? Python2 is required for ROS Melodic.

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

2 participants