Building Python Bindings for Conda Virtual Environment on Jetson #13807
-
Hi everyone, I'm working on building Librealsense (v2.56.3) on a Jetson agx orin device with JetPack6.2 [L4T 36.4.3]
After building, I was able to successfully import pyrealsense2 using the system Python (i.e. when I run python after deactivating conda). However, I recently created a new conda virtual environment called yolov5:
In this conda environment, when I try to run python and do import pyrealsense2, it fails.error below:
I suspect that changing the CMake parameter from: My Questions:
Any help or suggestions would be greatly appreciated! Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @happydrones Please first try changing your pyrealsense2 import line to the one below.
Does the ModuleNotFoundError still occur when using that modified command? I also recommend using the command which python3 to check whether the PYTHONPATH is the same when using Conda, as for some Conda users they have a different path than when using Python 3. After finding the path, input the PYTHONPATH command into the terminal before running your script. Use the command below but change the path to whatever 'which python3' provides.
I did not find a previous successful example of using Conda with librealense and pyrealsense2 on Jetson. There is a librealsense / pyrealsense2 guide for Conda at the link below though that is not specific to Jetson. |
Beta Was this translation helpful? Give feedback.
-
You should not need to use the -DPYTHON_EXECUTABLE flag unless you have more than one version of Python (such as Python 2 and Python 3) installed on your computer, as the flag tells the installation which Python version to use with the pyrealsense2 wrapper. |
Beta Was this translation helpful? Give feedback.
Hi @happydrones Please first try changing your pyrealsense2 import line to the one below.
import pyrealsense2.pyrealsense2 as rs
Does the ModuleNotFoundError still occur when using that modified command?
I also recommend using the command which python3 to check whether the PYTHONPATH is the same when using Conda, as for some Conda users they have a different path than when using Python 3. After finding the path, input the PYTHONPATH command into the terminal before running your script. Use the command below but change the path to whatever 'which python3' provides.
export PYTHONPATH=$PYTHONPATH:/usr/local/lib
I did not find a previous successful example of using Conda with librealense and…