Closed ShettyHarapanahalli closed 3 years ago
Hi @ShettyHarapanahalli If you are using Ubuntu 20 and experiencing the error /librealsense/build/third-party/libusb/libusb/core.c:23:10: fatal error: config.h: No such file or directory 23 | #include "config.h" then advice about a fix for it is provided in the link below:
https://github.com/IntelRealSense/librealsense/issues/6436#issuecomment-653942842
I see that you have already used the first step of the recommendations, involving installing sudo apt-get install libusb-1.0-0-dev. Does the rest of the guidance match up with what you have already tried, please?
Thanks for the link. I got a big list of warnings but installed it successfully.
Any help with this, please -
suman@SumanDL:~/sandbox/librealsense/build$ python3 Python 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import pyrealsense2 as rs pipeline = rs.pipeline() Traceback (most recent call last): File "
", line 1, in AttributeError: module 'pyrealsense2' has no attribute 'pipeline'
Hi @ShettyHarapanahalli I usually see this error occur on Nvidia Jetson and Raspberry Pi computing boards. Are you using a Jetson or Pi board please?
This is on laptop, I have ubuntu 20 trying to use it with python3.8.
The pip package installation would not work because at the time of writing this, pip installation up to Python 3.7 only is supported (though Intel have been actively working on adding support for newer Python versions recently).
In the meantime, building the pyrealsense2 wrapper from source code with CMake like you have been doing is the best option for Python versions newer than 3.7.
Though you are using a laptop, there was a Jetson case involving AttributeError: module 'pyrealsense2' has no attribute 'pipeline' where the solution in that particular case was found to be to copy .so files to the same directory that the user's project script was in.
https://github.com/IntelRealSense/librealsense/issues/7078#issuecomment-672949007
This same approach of copying the .so files into the same directory as the user's project script also worked in another case involving Pi:
https://support.intelrealsense.com/hc/en-us/community/posts/360048396854/comments/360012486393
I see only one file getting generated for some reason. Can you please help me fix this -
Cmd line dump - build$ ls *.so librealsense2.so
Okay, first please copy librealsense2.so to the same folder that your project script is in. Then find your pyrealsense2.so file and copy this into the folder alongside your project script too.
When using Python 3, the pyrealsense2.so file will not be called exactly that but have an unusual name based on the version of Python that you are using (such as pyrealsense2.cpython-37m-arm-linux-gnueabihf.so or something complex like that).
I recall that when I was performing a pyrealsense2 installation, I found it by going to the parent folder of the Python installation (e.g Python37) and doing a file search from that folder location for the search term pyrealsense2.so. This search located where the strangely named version of the pyrealsense2.so file was on my computer so that I could copy it into the folder where my project script was.
added this in 1st line of the file- librealsense/CMake/opengl_config.cmake set(OpenGL_GL_PREFERENCE "GLVND")
Path of the file - librealsense/build//librealsense2.so librealsense/build/wrappers/python/pybackend2.cpython-38-x86_64-linux-gnu.so
But of no output get, I have copied the *.so file to the example folders and executed python3 align-depth2color.py. CMD line dump of the same is below -
suman@SumanDL:~/sandbox/librealsense/wrappers/python/examples$ ls *.so
librealsense2.so pybackend2.cpython-38-x86_64-linux-gnu.so
suman@SumanDL:~/sandbox/librealsense/wrappers/python/examples$ python3 align-depth2color.py
Traceback (most recent call last):
File "align-depth2color.py", line 16, in
Regarding having copied pybackend2.cpython-38-x86_64-linux-gnu.so to beside your project script, i don't believe that this is the correct file. It should start with 'pyrealsense2' and end in '.so' like the pyrealsense2.cpython-37m-arm-linux-gnueabihf.so example file-name structure that I mentioned earlier.
If an installation has numerous problems that require multiple fixes to be applied then it is usually easier to go back to the beginning, start the process over again and try to find out what the problem with the previous installation may have been.
For example, in your build you are using CMake to build librealsense and the Python wrapper together from source code, using -DFORCE_RSUSB_BACKEND=true. In this build method, there is no kernel patching required.
A flag that is usually included in a CMake build statement that is building librealsense at the same time as building librealsense though is -DPYTHON_EXECUTABLE. This condition defines which Python installation on the computer should be targetted. Your CMake instruction at the start of this case does not include this flag. -DPYTHON_EXECUTABLE should be set to = the exact path where your Python 3.8 installation is located on your computer.
Please provide a description of the problem- I am trying to install the python wrapper with "pip3 install pyrealsense2" but it did not work, so tried to install with build with the cmake command "cmake ../ -DFORCE_RSUSB_BACKEND=true -DBUILD_PYTHON_BINDINGS=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true" I get the below error -
/home/suman/sandbox/librealsense/build/third-party/libusb/libusb/core.c:23:10: fatal error: config.h: No such file or directory 23 | #include "config.h"
I did install the usblib but of no use -
sudo apt-get install libusb-1.0-0-dev
Can you please help me fix the same.