RuntimeError: No device connected
| Required Info | |
|---|---|
| Camera Model | D435i |
| Firmware Version | 5.55.1 |
| Operating System & Version | Ubuntu 20.04 |
| Kernel Version (Linux Only) | |
| Platform | LubanCat-4 V1 |
| SDK Version | 2.55.1 |
| Language | Python |
Issue Description
Hello, I only wrote the following code and ran it,
import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 15)
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 15)
profile = pipeline.start(config)
but it gave me an error . How can I troubleshoot and resolve this?
Traceback (most recent call last):
File "/home/noetix/work/dev/realsense_project/test.py", line 13, in <module>
profile = pipeline.start(config)
RuntimeError: No device connected
Hi @zhang-qihao Is the camera detected if you launch your program in sudo admin permissions mode, please?
sudo python3 test.py
Thank you for your reply. Even after adding sudo, the error still occurs.
By the way, my architecture is
aarch64.
What method did you use to install librealsense, please? On non-mainstream computing devices, such as your LubanCat, it is recommended to build librealsense from source code using the libuvc backend installation method at the link below.
https://github.com/IntelRealSense/librealsense/blob/master/doc/libuvc_installation.md
The libuvc method provides a pre-made build script called libuvc_installation.sh
https://github.com/IntelRealSense/librealsense/blob/master/scripts/libuvc_installation.sh
A RealSense user at https://github.com/IntelRealSense/librealsense/issues/14047 who also had a LubanCat 4 recently used the libuvc installation procedure and was able to achieve a working setup.
Thank you for your reply.
Yes, I used the libuvc backend installation method.
I will try to clear the previously configured environment and recompile the source code, as I didn't directly install the libuvc version at the first time.
May I ask if there is any way to completely clean up all the configured SDK environments?
For package installations, you can remove them with the command below.
dpkg -l | grep "realsense" | cut -d " " -f 3 | xargs sudo dpkg --purge
To remove a source code installation, you can go to the 'build' directory of the librealsense source code folder that was used to install that SDK and input the CMake build command below to uninstall that SDK and clean up CMake:
sudo make uninstall && make clean
Unfortunately, after attempting to clean the previous environment and recompile the source code, pyrealsense2 still cannot detect the camera. I would greatly appreciate it if you could let me know what specific information I should provide to help with debugging. Thank you in advance!🙏
The next action to try will be to downgrade your camera firmware driver to the older version 5.13.0.50. You can downgrade in the RealSense Viewer tool using the following procedure:
- Download the firmware .bin file for 5.13.0.50 from the firmware releases page at the link below.
https://dev.realsenseai.com/docs/firmware-releases-d400
Do not attempt to install a firmware version older than 5.13.0.50.
-
Open the RealSense Viewer and go to the More option near the top of the Viewer's options side-panel. Select the Update Firmware option from its drop-down menu. This will cause a file selector box to pop up.
-
Navigate to the location on your LubanCat where you downloaded the firmware .bin file to and select the file. The firmware update process should then automatically begin.
If you are unable to access RealSense Viewer on your LubanCat then the downgrade can be performed on any computer that can use the Viewer, including Ubuntu and Windows ones, as the firmware is stored inside the camera and not on the computer, so is carried inside the camera to whatever computer you plug the camera into.
Thank you very much for your response.
I will try downgrading the firmware tomorrow to see if it helps resolve the issue.
In addition, I have a couple of questions regarding the installation process.
I installed the pyrealsense2 package using pip. What is the correct and recommended way to install the pyrealsense2 package?
When building the SDK from source, does specifying the CMake flags -DBUILD_PYTHON_BINDINGS=ON -DPYTHON_EXECUTABLE=$(which python3) automatically generate the pyrealsense2 Python bindings?
I sincerely appreciate your guidance on this.
It appears that the LubanCat CPU chip is ARM architecture, so this means that the Python versions supported by the pip install pyrealsense2 installation method will be 3.7 to 3.10. If your Python 3 version is newer than 3.10 then the pyrealsense2 wrapper would have to be built from source code.
Yes, when building the SDK from source, specifying those CMake flags causes the pyrealsense2 wrapper to automatically be built from source code at the same time as the librealsense SDK. The built pyrealsense2 files should then be able to be found in the librealsense > build >wrappers > python directory of the librealsense source code folder.
After compiling with those CMake flags, is pip install pyrealsense2 still required?
It appears that the LubanCat CPU chip is ARM architecture, so this means that the Python versions supported by the pip install pyrealsense2 installation method will be 3.7 to 3.10. If your Python 3 version is newer than 3.10 then the pyrealsense2 wrapper would have to be built from source code.
Yes, when building the SDK from source, specifying those CMake flags causes the pyrealsense2 wrapper to automatically be built from source code at the same time as the librealsense SDK. The built pyrealsense2 files should then be able to be found in the librealsense > build >wrappers > python directory of the librealsense source code folder.
I do find the pyrealsense2.cpython-38-aarch64-linux-gnu.so file under the build/release directory, but I couldn't find any .so file under the build/wrappers/python directory.
Should I copy this .so file to the site-packages directory of Python 3?
After copying it there, I tried running my test script again, but I still encountered the error: RuntimeError: No device connected.
Thank you for your assistance! After restarting, I successfully used Python to access the camera.
It can be noted that compiling the pyrealsense2 wrapper alongside the SDK resolves the issue.
Thank you once again for your help. Wishing you a fulfilling and joyful life!
You are very welcome. It's great to hear that you achieved a solution. Thanks very much for the update and best wishes to you too!