IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.62k stars 4.83k forks source link

Pyrealsense2 : Can't able to build from source #12641

Open Muthukumar4796 opened 9 months ago

Muthukumar4796 commented 9 months ago

| Camera Model | D455 | | Operating System & Version | Ubuntu 22.04 | | Language | python |

I'm trying to install Pyrealsense 2 by building it from source. However, during the build process, it keeps showing an error.

I have attached the error for your reference.build_error.txt

MartyG-RealSense commented 9 months ago

Hi @Muthukumar4796 Are you able to compile the librealsense SDK successfully without the pyrealsense2 wrapper? If so then you could afterwards install the wrapper separately from packages instead of source code with the command pip install pyrealsense2

At the time of writing this, the pip install method of installing the wrapper supports Python 3.7 to 3.11 on computers / computing devices with x86 / x64 architecture (such as laptop and desktop PCs) and Python 3.7 to 3,9 on Arm architectured devices (such as Nvidia Jetson and Raspberry Pi).

Muthukumar4796 commented 9 months ago

My main goal is to fully build the pyrealsense2 library from source with CUDA on my Ubuntu 22.04 PC, and ensure that it only uses the GPU and not the CPU. If you have any ideas on how to accomplish this, please provide step-by-step instructions.

MartyG-RealSense commented 9 months ago

CUDA support in the librealsense SDK requires an Nvidia GPU and is enabled by including the flag -DBUILD_WITH_CUDA in the CMake build instruction. It is usually only used with the Nvidia GPU on Nvidia Jetson computing boards though and the few attempts made in the past to use it on an Nvidia equipped PC have not worked..

The only operations that librealsense's CUDA support accelerates are YUY to RGB color conversion, depth-color alignment and point clouds. So if you are not using point clouds or alignment in your project then CUDA will not reduce CPU utilization.

Muthukumar4796 commented 9 months ago

I have a laptop with a built-in Nvidia-1650 graphics card that supports CUDA version 12.2. It runs Ubuntu 22.04. However, you mentioned that Nvidia-equipped PCs not work for building pyrealsense2. Therefore, I am unable to build pyrealsense2 for my PC. Could you suggest an alternative method for me to do this?

MartyG-RealSense commented 9 months ago

PCs with an Nvidia GPU have difficulty enabling librealsense's CUDA support but CUDA is not required for pyrealsense2 and you can build the wrapper on PC without enabling librealsense's CUDA support.

Muthukumar4796 commented 9 months ago

Yes but it consumes CPU, and I have another process that requires CPU power.Thats why I tried to build with GPU.

MartyG-RealSense commented 9 months ago

The librealsense SDK has an alternative to CUDA for offloading work onto the GPU called GLSL processing blocks, and it is 'vendor neutral' meaning that it can work with any GPU brand and not just Nvidia. However, it is meant for use with C++ and so may not be helpful to you if your project requires Python. Please see https://github.com/IntelRealSense/librealsense/pull/3654 for further details about GLSL.

There are not other options than CUDA and GLSL for offloading RealSense processing to the GPU, unfortunately.