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

[pyrealsense2] Unknown Error when Running Pyrealsense2 #5049

Closed
riven314 opened this issue Oct 15, 2019 · 6 comments
Closed

[pyrealsense2] Unknown Error when Running Pyrealsense2 #5049

riven314 opened this issue Oct 15, 2019 · 6 comments

Comments

@riven314
Copy link

riven314 commented Oct 15, 2019

Required Info
Camera Model D435i
Firmware Version 05.11.06.250
Operating System & Version Ubuntu 18.04
Kernel Version (Linux Only) 5.0.13-050013-generic
Platform Lenovo Legion Y740
SDK Version NA
Language Python
Segment NA

Issue Description

I created a conda environment and installed pyrealsense2 by pip install pyrealsense2 .

I didn't install any SDK 2.x (as I knew my kernel is not LTS version and the related sdk installation to non-LTS kernel is a bit heavy for me). When I tested pyrealsense2 package in Python, I encountered the following error:

Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyrealsense2 as rs
>>> pipeline = rs.pipeline()
>>> pipeline.start()\
... 
KeyboardInterrupt
>>> pipeline.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.5/0003:8086:0B3A.0005/HID-SENSOR-200076.2.auto/iio:device1/scan_elements/in_anglvel_x_en Last Error: Permission denied

I didn't find any related situation in the existing raised issues. How could I settle this? (hopefully without installing SDK 2.x).

Remark:

  1. from USB device viewer, I can see that my Realsense camera is detected
@ev-mp
Copy link
Collaborator

ev-mp commented Oct 15, 2019

@riven314 , the permission error might be due to improperly installed udev-rules.
Did you run the script specified in the installation guide ?
./scripts/setup_udev_rules.sh

Are you able to run realsense-viewer and stream IMU data without sudo?

@riven314
Copy link
Author

riven314 commented Oct 15, 2019

@ev-mp , as far as I can remember, I did run the first 2 steps of the installation. i.e.:

$ sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
$ sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev

But I can't remember if I ran ./scripts/setup_udev_rules.sh. Is there any way I can check it?
Also, is it possible I can undo the above for recovery?

@ev-mp
Copy link
Collaborator

ev-mp commented Oct 16, 2019

@riven314 hi, the script copies a file named 99-realsense-libusb.rules to the following location /etc/udev/rules.d/ and re-triggers the appropriate service to be aware of the new addition. Check whether the file can be found at the designated place and if not - run the script.

To undo the script just delete that rules file from the file system and then refresh the service once more ( the exact syntax is in the script file) or reboot.

@riven314
Copy link
Author

riven314 commented Oct 17, 2019

@ev-mp , thanks for the suggestion! pipeline.start() works now after I ran ./scripts/setup_udev_rules.sh.

However, when I proceeded to sample run $ python opencv_viewer_example.py, I encountered the following error:

QObject::moveToThread: Current thread (0x55c9970952d0) is not the object's thread (0x55c9970e2d40).
Cannot move to target thread (0x55c9970952d0)

Segmentation fault (core dumped)

Do you have any idea if it belongs to sdk issue? As a remark (not sure if it is relevant), I ran it in a standalone conda environment. In the conda environment, I installed opencv by PIP (i.e. pip install opencv-python)

@ev-mp
Copy link
Collaborator

ev-mp commented Oct 22, 2019

@riven314 hi, the error is not related to the SDK -

QObject::moveToThread..

as we don't use Qt. Goolge suggests that the error is a conflict in the OpenCV distribution shipped with Qt.

SDK-wise the OpenCv examples require version 3.4

@riven314
Copy link
Author

@ev-mp , Thanks for the suggestion. I have solved the issue now!
I configured a new conda environment. I firstly installed pyrealsense2 by $ pip install pyrealsense2. And then I installed opencv by $ conda install -c conda-forge opencv. Dependent version of opencv (version 3.4 in this case) was automatically detected and installed.
I can run through opencv_viewer_example.py now!

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