I couldn't import librealsense2
I have a Jetson Nano and I tried to use pyrealsense2 library via building from source. I couldn't get any error during installation but i got "no module named pyrealsense2.pyrealsense2" error. Also i added the .so files into the same folder with the python script that i run
this script from librealsense github:
jetpack: 4.4
ubuntu: 18.04
python 3.10.0
-
Hi Abdullaherzin80 It is rare that the pyrealsense2.pyrealsense2 instruction is used. It is more common to use import pyrealsense2 as rs
Does the script work if you only have one pyrealsense2 in your import instruction?
-
I already used import pyrealsense2 as rs in in the python file. The error caused because of the __init__.py at the /usr/local/lib/python3.10/pyrealsense2 location. I saw some suggestion at realsense github issues, so i copy the __init__ file into the that directory. If i remove the __init__ file from /usr/local/lib/python3.10/pyrealsense2, I got error like "Attribute error: module 'pyrealsense2' has no attribute 'pipeline' at ths line:
pipeline = rs.pipeline()
there is no error while importing pyrealsense2 like import pyrealsense2 as rs but i can't use any of the pyrealsense function, even this:
print(rs.__version__) -
If you are using a Linux computer then the two .so files to copy to the same folder as your project script are librealsense2.so and pyrealsense2.so. If the folder image above is from your Jetson Nano then I can see a librealsense2.so file in the folder but not pyrealsense2.so.
Building the pyrealsense2 wrapper for Python 3.10 from source code is fine, and your JetPack 4.4 version is compatible with the RealSense SDK.
Please sign in to leave a comment.
Comments
4 comments