"No device connected" error on mac
Hi! I have just downloaded the librealsense on mac and trying to start building my project when when I run the code (the example code from github) it gives the following error even though I just tried the camera on the Windows device before testing it on Mac.
profile=pipeline.start()
RuntimeError: No device connected
Mac version is 11.2.1 Big Sur
Python 3.8.2
-
Have you been able to test the camera on your Mac with pre-existing RealSense SDK programs such as the RealSense Viewer tool?
If you believe that there may be a problem with your SDK installation on Mac and you have an Intel-based Mac model rather than a recent Apple Silicon M1 model, the discussion in the link below provides guidance for installing the SDK and the Python compatibility wrapper with the instruction brew install librealsense
https://github.com/IntelRealSense/librealsense/issues/2811
Further information about 'brew install librealsense' can be found here:
-
Hi,
I'm seeing this also but I'm using the RealSense Viewer from Intel. The viewer works fine and I can load/see stored bag files. I don't see the device itself though when I plug it in. On windows all is well. I have tried several USB cables and ports (USB-C directly on the MacBook Pro also).
MacBook Pro (16-inch, 2019)
2.3 GHz 8-Core Intel Core i9
Mac OS 12.0.1Thoughts? Looking in /dev I see no new devices when I plug in or unplug the camera.
Camera is a D435i.
Dan
-
Some more updates. I do see the device in the System Info Viewer. In RealSense Viewer I get the log:
14:06:17 [Info] - librealsense version: 2.49.0
14:06:17 [Error] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/libusb/handle-libusb.h:95 - failed to claim usb interface: 0, error: RS2_USB_STATUS_ACCESS
14:06:17 [Error] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/sensor.cpp:537 - acquire_power failed: failed to set power state
14:06:17 [Warn] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/rs.cpp:308 - null pointer passed for argument "device"
14:06:17 [Warn] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/rs.cpp:2621 - Couldn't refresh devices - failed to set power state
14:06:17 [Info] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/rs.cpp:2618 - Framebuffer size changed to 1120 x 630
14:06:17 [Info] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/rs.cpp:2618 - Scale Factor is now 1
14:06:17 [Info] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/context.cpp:381 - Found 1 RealSense devices (mask 0xfe)
14:06:30 [Info] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/rs.cpp:2618 - Framebuffer size changed to 1575 x 630
14:06:30 [Info] /tmp/librealsense-20211029-92445-cmfu7r/librealsense-2.49.0/src/rs.cpp:2618 - Window size changed to 1575 x 630 -
Last update. This is already being tracked here:
https://github.com/IntelRealSense/librealsense/issues/9916
-
Hi Ddfleck Yes, when I saw that you were using MacOS 12.0.1 I thought that the non-detection of the camera may be related to the USB issues with Monterey discussed on the RealSense GitHub support forum in case 9916, especially as the camera performs correctly on Windows. I would therefore recommend following that discussion.
-
Hi Begaiym Kudainazarova Which RealSense camera model are you using, please?
-
Thanks very much, Begaiym Kudainazarova
What is the librealsense SDK version that you are using, please? I ask this because before version 2.42.0, RealSense camera models such as D435i that contain an IMU component had problems with working on Mac, as described in the link below.
https://github.com/IntelRealSense/librealsense/pull/8029
-
You mentioned that the RealSense Viewer program worked fine, suggesting that the camera and the RealSense SDK installation in general is okay and that the problem is with the pyrealsense2 installation specifically (as pyrealsense2 worked before the reinstall).
Were you using Monterey before the reinstallation or did you upgrade to Monterey from an older MacOS version such as Big Sur during the reinstall?
A RealSense user created a pre-built Mac version of pyrealsense2 with an automated installer, though it was only tested with the Catalina and Big Sur MacOS versions so far.
-
Thank you MartyG for your help. I tried reinstalling the librealsense folliwing the same instructions from github again and it worked! I can make it work on VSCode without any troubles, but when it comes to the jupyter notebook it gives me following error:
--------------------------------------------------------------------------- ImportError Traceback (most recent call last) /var/folders/z4/p6zl93qx4ws3q9vbwx901llc0000gn/T/ipykernel_4060/2486884069.py in <module> ----> 1 import pyrealsense2.pyrealsense2 as rs ImportError: dlopen(/usr/local/lib/python3.9/site-packages/pyrealsense2/pyrealsense2.cpython-38-darwin.so, 2): Library not loaded: @rpath/librealsense2.2.50.dylib Referenced from: /usr/local/lib/python3.9/site-packages/pyrealsense2/pyrealsense2.2.50.0.cpython-38-darwin.so Reason: image not found
I did all the ijmports and appended the sys.path. Do I still need to copy these .so files somewhere else?
-
It's great to hear that you made significant progress!
If the PYTHONPATH path variable has been defined correctly when building the pyrealsense2 wrapper then you should not need to place the two .so files in the same location as your project script in order for pyrealsense2 to be able to find Python 3.
I note that you have a reference to /usr/local/lib/python3.9 but the auto-generated name of your pyrealsense2.so file is 'pyrealsense2.2.50.0.cpython-38-darwin.so'. If Python 3.9 was the Python 3 version installed on your computer at the time that the wrapper was being built then I would expect the pyrealsense2.so filename to generate with the term cpython-39 (in reference to Python 3.9) instead of cpython-38.
Did you build the wrapper for Python 3.8 first and then upgrade Python to 3.9 after the pyrealsense2 build was completed, please? That might account for the discrepancy between the .so filename and the /usr/local/lib/python3.9 path.
-
Hello MartyG! I am sorry for not responding for so long. Yes I noticed that too. When i was downloading I used python 3.8 environment. But once I completed downloading I found the package in the python 3.9 environment.
-
Thanks very much Begaiym Kudainazarova for the update. Are you still having the same problem with Jupyter Notebook, please?
-
It seems likely that pyrealsense2 is having difficulty with your Python installation, perhaps due to the mismatch between Python 3.9 and the pyrealsense2 files having been built for Python 3.8. If possible, I would recommend building the pyrealsense2 wrapper again for Python 3.9 so that you have a pyrealsense2.so file with a name such as pyrealsense2.2.50.0.cpython-39-darwin.so
Before doing that though, you could first test whether the problem is due to a mismatch with Python / pyrealsense2 or an issue with Jupyter Notebook specifically by trying to run a non-Jupyter pyrealsense2 script. The wrapper has an example script to try at the link below.
Please sign in to leave a comment.
Comments
18 comments