Running multiranger_pointcloud.py example

Discussions and questions about the Crazyflie Nano Quadcopter
emoyers
Beginner
Posts: 12
Joined: Sat Feb 08, 2020 5:26 pm

Running multiranger_pointcloud.py example

Post 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?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Running multiranger_pointcloud.py example

Post 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.
emoyers
Beginner
Posts: 12
Joined: Sat Feb 08, 2020 5:26 pm

Re: Running multiranger_pointcloud.py example

Post by emoyers »

I'm using python 3.5.2. Do I need an specific version for vispy?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Running multiranger_pointcloud.py example

Post 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.
emoyers
Beginner
Posts: 12
Joined: Sat Feb 08, 2020 5:26 pm

Re: Running multiranger_pointcloud.py example

Post 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?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Running multiranger_pointcloud.py example

Post 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.
emoyers
Beginner
Posts: 12
Joined: Sat Feb 08, 2020 5:26 pm

Re: Running multiranger_pointcloud.py example

Post by emoyers »

Thanks @tobias I was able to run it with python 3.7.5.
boped
Beginner
Posts: 3
Joined: Fri May 15, 2020 3:38 pm

Re: Running multiranger_pointcloud.py example

Post 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
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Running multiranger_pointcloud.py example

Post 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?
boped
Beginner
Posts: 3
Joined: Fri May 15, 2020 3:38 pm

Re: Running multiranger_pointcloud.py example

Post 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!
Post Reply