-
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
Running pyrealsense2 on JetsonNano #6964
Comments
Hi @fredy1221 The pyrealsense2 wrapper cannot be installed with the pip install pyrealsense2 method on devices with Arm processors such as Jetson, because the PyPi pip packages are not compatible with Arm processors.. That typically means that the best option is to use CMake to build librealsense and the Python bindings at the same time. The first step in this process is to download the source code of librealsense from the Releases page as a zip file. The source code zip file can always be found in the "Assets" list at the bottom of the information listing for each SDK version on the Releases page. https://github.com/IntelRealSense/librealsense/releases/ After downloading the zip file, its contents should be extracted so that you have a librealsense folder.At this point you can use the RSUSB installation method to install librealsense without dependence on Linux versions or kernel versions and without the need for patching. This makes this installation method particularly suited to Arm devices such as Jetson. The backend installation method requires an internet connection. The steps are:
mkdir build && cd build
cmake ../ -DFORCE_RSUSB_BACKEND=ON -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=... The above statement is a basic one that should test whether the build is likely to succeed or not. If it does succeed then you can try a more advanced build, which builds the example programs and includes optimizations such as building with CUDA support for faster alignment processing on devices such as Jetson that are equipped with an Nvidia graphics GPU. cmake ../-DFORCE_RSUSB_BACKEND=ON -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=... -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true -DBUILD_WITH_CUDA:bool=true |
Thank you for your help, it worked! |
Excellent news - thank you very much for the update! :) |
Hello @MartyG-RealSense - Thanks for your inputs so far! On a fresh install of JetPack 4.4 with Python3.7 as default (python3), I ran into this issue while installing basic command you provided.
UPDATE: I was able to resolve this issue by installing these two packages.
Hope it helps someone looking for the complete answer! cheers. |
It's great that you quickly found a solution to your particular problem @ramgrandhi - thanks so much for sharing it! |
You're welcome @MartyG-RealSense! Though I can see pyrealsense2 packages installed, I still cannot import them from python3 REPL. Do you think I should explicitly create symlinks ?
cheers! |
@ramgrandhi If you think that you need symbolic links (most people do not use them with Pyrealsense2), this may be a useful reference: Otherwise you could try this: |
I am having the same issue, where I could originally see the stream from the camera but after installing pyrealsense2 wrapper it stopped working. I followed @MartyG-RealSense 's instructions (which were great btw) and got all the way through without any errors. However, when i run 'realsense-viewer' from command line it opens v2.31.0, rather than the version I have just complied with make/cmake which is v2.38.1. I think having v2.31.0 is the problem as my L515 is not detected by it, so when i run any example python scripts (from the new folder) or the realsesense-viewer then the camera is not detected... I'm sure many other people will find themselves on this page after having issues installing realsense, and have probably (like me) tried other tutorials that have installed other versions deep within the filesystem. So my question: is there any easy way to remove the old version and swap it with the new one? and how do I link it to the 'realsense-viewer' command which is presumably calling the app from a link in /usr/bin folder? |
Hi @birdistheword96 Official support in the SDK for the L515 camera model began with version 2.35.2. If you built from source code with CMake then the link below provides guidance about where to find the built binary of the Viewer within the folder structure of the 2.38.1 SDK version that you have just built. If you have 2.31.0 installed somewhere on your Jetson and you built it from source code, you could go to the build folder of that SDK and run this CMake command from that location: sudo make uninstall && make clean This should uninstall the SDK and clean up old files. |
@MartyG-RealSense again thank you for the uninstall suggestion, this seems to have worked because I can run the realsense-viewer from the command line (although it reports to be 2.35.2, despite being built from 2.38.1) and I can now see the camera feed. I tried one of the python examples and it said it couldn't import the module pyrealsense2, I think i read somewhere that I have to ad it to the python path or copy a .so file into the folder, is that correct? |
Hi @birdistheword96 Getting the Python wrapper working can depend on what term is used with DPYTHON_EXECUTABLE as this dictates how to find your Python installation. If you have Python 3 installed and making DPYTHON_EXECUTABLE = ... does not work, then a good starting point for testing is to use this term: -DPYTHON_EXECUTABLE=/usr/bin/python3 |
hi @MartyG-RealSense , initially the DPYTHON_EXECUTABLE = ... didnt work, so I tried -DPYTHON_EXECUTABLE=/usr/bin/python3 and that compiled successfully. However, I am unable to import the library, so I assume I am doing something wrong? or do I need to add something to the python path, or put the library in the same folder thatthe python file is in? |
Can you provide the error message that you get when you are unable to import pyrealsense2, please? |
Yeah sure, should have included it in the original message sorry:
I know that this error means it can't find the module to import, so I either need to add it to the python path or copy the library into the local folder where python file is. But which file is it that I need to copy specifically? or whoch directory shoudl i be adding to the python path and is there an easy way to do it? Thanks for all your help so far @MartyG-RealSense! |
@birdistheword96 Reading back to your original comment on this case in #6964 (comment) I note that you are using the L515 model. Could you therefore create a new issue about your current problem with ModuleNotFoundError: No module named 'pyrealsense2' and mention L515 in the case title please, as somebody else on the RealSense team other than myself is responsible or handling L515-related cases. I do apologise. |
@MartyG-RealSense No problem, will do. |
@MartyG-RealSense Thank you very much for the instructions above. Unfortunately, I am still having trouble importing pyrealsense2. Here are the steps I followed:
Now when I try to import it into python3, I get the following error.
I can see the librealsense2* files in
I have also tried rebooting the Nano, still no luck. Let me know if you need any more information. |
Hi @Drkstr Another RealSense user with a Jetson who had the No module named 'pyrealsense2 error solved it by putting the two lines below at the end of their bash file as the final two lines: export PATH=$PATH:~/.local/bin You can also check that your PYTHONPATH is set to the correct location by the bash file by using the command below after the bash script has been run: echo $PYTHONPATH |
@MartyG-RealSense Thanks for the reply I have added the following to the end of my .bashrc file and sourced the file
Still not able to import Not sure what else to try at this point 😿 |
|---------------------------------|------------------------------------------- |
| Camera Model | D435i |
| Firmware Version | |
| Operating System & Version | Linux Ubuntu 18 LTS |
| Platform | NVIDIA Jetson Nano |
| Realsense SDK Version | legacy 2.36.0 |
| Language | python |
| Segment | Industrial robot |
Issue Description
I'm using Intel Realsense D435i connected to a NVIDIA Jetson Nano.
The Jetson is flashed with Jetpack 4.3
First I installed RealSense viewer and it worked fine, I was able to stream from the camera in both depth and RGB.
Then I installed a pyrealsense2 python wrapper so I can start a pipeline to get a frame using a python script, now I can successfully import pyrealsense2 in my script but the device is no longer detected.
running: $ rs-enumerate-devices
returns: No device detected. Is it plugged in?
Even though the camera is plugged in
The text was updated successfully, but these errors were encountered: