-
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
RealSense D435i: Python Script Shows 'No Device Connected' While pyrealsense2 Imports Successfully and Viewer Runs #13297
Comments
Hi @andrewli1126 Does it make a difference if you launch your Python script in sudo admin permissions mode? For example: sudo python3 test.py |
Hello @MartyG-RealSense, I tried to run the script using sudo python3, but the camera still wouldn’t start. I also tried executing the code in the bash line by line, and I received the same runtime error. |
Is the camera still undetected by your Python script if you unplug the camera, wait a couple of seconds and then plug it back in before running your script? An unplug-replug will reset the pipeline. |
@MartyG-RealSense The camera still isn't detected by the Python script after unplugging and replugging. Could this be a problem with the Python wrapper? |
Sometimes the camera will work fine with the Viewer but not with the Python wrapper. There is not a clear reason why the wrapper will work for some users but not for others. Sometimes it could take four unplug-replugs of the camera or more before it is detected. I suspect that the PYTHONPATH is not the cause of the problem. Although pip install of the pyrealsense2 wrapper is supported on Arm devices, it usually does not work on Raspberry Pi and Nvidia Jetson boards, so I was surprised that installation completed successfully on your Jetson. I would usually recommend building the pyrealsense2 wrapper from source code on Jetson instead of using pip install pyrealsense2. |
Thank you @MartyG-RealSense :) The issue was resolved by uninstalling pyrealsense2 and rebuilding the wrapper from source. |
It's excellent news that a source code build of the wrapper succeeded, @andrewli1126 - thanks very much for the update. :) |
Case closed due to solution achieved and no further comments received. |
Hello @andrewli1126 @MartyG-RealSense |
Hi @Boatsure I have never heard of the pip package version of pyrealsense2 being uninstalled that way, but as pip uninstall is a valid command I guess that it must be possible to do so. Yes, building the wrapper from source means all the procedures from 'mkdir build' to 'sudo make install. The pyrealsense2 wrapper is part of the librealsense SDK, but it is not installed by default because not all RealSense users will be using Python. |
@MartyG-RealSense Thanks for your reply! |
That's great to hear, @Boatsure - thanks very much for the update about your success! |
Issue Description
Hello~
I have successfully installed the SDK packages and run pip3 install pyrealsense2 without any issues. The camera works perfectly with the RealSense Viewer. However, when I try to execute my Python script using the pyrealsense2 wrapper, I can import the module without any errors, but the pipeline fails to start, returning the error: "No device connected."
Steps Taken:
Could you please assist me in diagnosing this issue? Any guidance or suggestions would be greatly appreciated.
The text was updated successfully, but these errors were encountered: