-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Not able to use pyrealsense2. "No Module named pyrealsense2" #12377
Comments
Hi @ta-jetson If you have the .so files then an alternative to using a Python path to connect Python and pyrealsense2 together is to place the .so files librealsense2.so and pyrealsense2.so in the same folder that your project script is in. If you are using Python 2.7 then place pyrealsense2.so in the project folder. If using Python 3.6 then the pyrealsense2.so file that should be placed in the project folder is the one that will have a more complex auto-generated filename, such as pyrealsense2.cpython-36m-arm-linux-gnueabihf.so (one that starts with 'pyrealsense2' and ends with '.so'). The number in the middle of the filename, such as '36m', refers to the Python 3 version that you have got installed on your computer. 36m stands for Python 3.6. Almost all of your system configuration listed at the top of this case looks correct. It is worth mentioning though that the recommended camera firmware driver version to use with librealsense 2.48.0 is 5.12.14.50. Using a newer firmware such as 5.15.1.0 with an older SDK version may result in errors, as 5.15.1.0 is designed for use with SDK 2.54.2. |
In regard to using infrared and RGB simultaneously, yes you can as the D435i camera has its own dedicated RGB sensor separate from the IR sensors. |
Thank you @MartyG-RealSense But I can't run them simultaneously. Traceback (most recent call last): When I run the python file, and then realsense-ros file, [ERROR] [1699446990.264410758]: An exception has been thrown: xioctl(VIDIOC_S_FMT) failed Last Error: Input/output error How do I resolve this? |
The librealsense SDK operates under a set of rules called Multi-Streaming Model (see the link below) that determines how access to the sensors by more than one application is governed. The first program to access a particular stream type places a 'claim' on it and prevents another application from accessing that stream until the claim is released by the first program (such as by disabling streaming). So if realsense-ros enables a stream first, a Python script that is subsequently launched would be unable to use that stream. The reverse is also true if the Python script was run first and realsense-ros second - the Python script could use the stream but realsense-ros couldn't. As you are only using RGB in the Python script, let's make sure that realsense-ros is not also publishing the RGB stream and locking its access. Please try adding enable_color:=false to your launch instruction. If enable_color is true inside the launch file then the launch instruction command will override it and set it to false. |
Hey @MartyG-RealSense , Just a review on what I did to resolve (with the help of your advice) : The only change being -DPYTHON_EXECUTABLE=/usr/bin/python3.6 After that having the .so files in the project folder solved the "Module not found error problem". In terminal :
And I sourced my bashrc again. (Remember to make the changes in the bashrc according to " #10891 (comment)" Now, import pyrealsense2 works without the need of adding the .so files in your project folder. Using both the python and ros wrapper simultaneously issue was resolved by setting enable_color :=false. Thanks a lot again @MartyG-RealSense P.S : The only changes were python3.6 to python3.8. That is, In .bashrc :
In terminal :
I'll be closing the issue. |
You are very welcome. It's great to hear that you were successful. Thanks so much for sharing the details of your solution! |
@MartyG-RealSense
| Required Info
|---------------------------------|------------------------------------------- |
| Camera Model - D435i
| Firmware Version - 05.15.01.00
| Operating System & Version - Ubuntu 18|
| Release- 4.9.201 - tegra
| Jetpack - 4.5.1
| OpenCV - 3.4.3 with CUDA : YES
| Platform - Nvidia Jetson (Seed studio cariier)
| SDK Version- 2.48.0
| Realsense-ros - 2.3.1
Issue Description
I built librealsense according to the issue "RealSense SDK & pyrealsense2 Installation on Nvidia Jetson Modules #10891" . I used selim35's bash file.
In the DPYTHON_EXECUTABLE, i have used /usr/bin/python and /usr/bin/python3 (as well as python2.7 and python3.6). The build was completed successfully every time. I even got the .so files for pyrealsense2 as well.
I still can't import pyrealsense2 in both approaches. I tried
import pyrealsense2 as rs
as well as
import pyrealsense2.pyrealsense2 as rs
Both give the "Module not found error"
and
I noticed
"/usr/local/lib/python2.7/" or "/usr/local/lib/python3.6/" doesn't have pyrealsense2
Could you please suggest how I could proceed?
NOTE - I used libsense 2.48.0 and JP- 4.5.1 as in one of the issues this was suggested as a fix for the imu data which isn't received in the lastest version. (Tested)
I had another question
I plan on using the IR cameras through the ros wrapper for VIO and pyrealsense2 to access the rgb camera for detection. Would it be possible to use it simultaneously ?
The text was updated successfully, but these errors were encountered: