Page 1 of 2

Running multiranger_pointcloud.py example

Posted: Wed Mar 11, 2020 3:15 am
by emoyers
I'm having problems to run multiranger_pointcloud.py example, Do I need to use an specific version of python or vispy?
I'm getting this error: AttributeError: 'CanvasBackend' object has no attribute 'setParent'

If I comment these 2 lines, I'm able to run the script but I cannot visualize the datapoints:

#self.canvas.native.setParent(self)
#self.setCentralWidget(self.canvas.native)

Do you any idea on what can be the problem and how can I fix it?

Re: Running multiranger_pointcloud.py example

Posted: Wed Mar 11, 2020 12:01 pm
by tobias
Yes this sound like a version issue. Are you running the example with python2 or python3? I'm not sure it works with python2.

Re: Running multiranger_pointcloud.py example

Posted: Thu Mar 12, 2020 1:07 am
by emoyers
I'm using python 3.5.2. Do I need an specific version for vispy?

Re: Running multiranger_pointcloud.py example

Posted: Thu Mar 12, 2020 8:47 am
by tobias
I'm running python 3.7.5 and it works for me but after smaller investigation it seams to be a Qt issue. They broke the API at some point but looks fixed now. Easiest solution is probably to update everything rather then downgrading Qt.

Re: Running multiranger_pointcloud.py example

Posted: Thu Mar 12, 2020 11:05 pm
by emoyers
I'm using ubuntu right now. When you say update everything, do you mean run "app-get update" and install python 3.7.5?

Re: Running multiranger_pointcloud.py example

Posted: Fri Mar 13, 2020 8:04 am
by tobias
You could try "app-get update" but it depends on what Ubuntu version (e.g. 19.04) you are on. Possible, at the version you have, 3.5.2 might be the latest.

Re: Running multiranger_pointcloud.py example

Posted: Sat Mar 14, 2020 3:28 am
by emoyers
Thanks @tobias I was able to run it with python 3.7.5.

Re: Running multiranger_pointcloud.py example

Posted: Sun May 17, 2020 8:38 am
by boped
Hallo,
I have the same Problem:

AttributeError: 'CanvasBackend' object has no attribute 'seParent'

You said its a Problem with the Verison of Python. I run it on a rasberry and have python 2.7.16 and
python 3.7.3. How can i know on wich version the programm runs? Or simply how can I solve the problem?

Thanks a lot

boped

Re: Running multiranger_pointcloud.py example

Posted: Mon May 18, 2020 6:44 am
by kristoffer
I think it is more likely that it is related to vispy rather than python, and that different python versions may not use the same version of vispy.

if you run

Code: Select all

python --version
you can see which version you use of python.

Is there any more information in the error message that you can share? A callstack?

Re: Running multiranger_pointcloud.py example

Posted: Mon May 18, 2020 8:16 am
by boped
if I run:

Code: Select all

python --version
it says: Python 2.7.16
and if i run :

Code: Select all

python3 --version
it says: Python 3.7.3

But the Idel Shell says 3.7.3 so I think its not a version problem, too.
Here is the full message of Idle:
>>>
RESTART: /home/pi/Desktop/crazyflie-lib-python-master/crazyflie-lib-python-master/examples/multiranger_pointcloud.py
WARNING: Although PyQt5 is already imported, the PyQt5 backend could not
be used ("cannot import name 'QtOpenGL' from 'PyQt5' (/usr/lib/python3/dist-packages/PyQt5/__init__.py)").
Note that running multiple GUI toolkits simultaneously can cause side effects.
WARNING:vispy:Although PyQt5 is already imported, the PyQt5 backend could not
be used ("cannot import name 'QtOpenGL' from 'PyQt5' (/usr/lib/python3/dist-packages/PyQt5/__init__.py)").
Note that running multiple GUI toolkits simultaneously can cause side effects.
Traceback (most recent call last):
File "/home/pi/Desktop/crazyflie-lib-python-master/crazyflie-lib-python-master/examples/multiranger_pointcloud.py", line 363, in <module>
win = MainWindow(URI)
File "/home/pi/Desktop/crazyflie-lib-python-master/crazyflie-lib-python-master/examples/multiranger_pointcloud.py", line 101, in __init__
self.canvas.native.setParent(self)
AttributeError: 'CanvasBackend' object has no attribute 'setParent'
>>>
The code is the example from the crazyflie-lib-python-master "multiranger_pointcloud"

Thanks for helping!