Skip to content
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

Ubuntu 20.04 #6568

Closed
DieProgrammIDE opened this issue Jun 10, 2020 · 24 comments
Closed

Ubuntu 20.04 #6568

DieProgrammIDE opened this issue Jun 10, 2020 · 24 comments

Comments

@DieProgrammIDE
Copy link

  • Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):

  • All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)


I have, stupid as i am, updated all my machines to Ubuntu 20.04 and have lots of problems. The Kernel Module from the SDK isn't built because the kernel is newer. Would a Kernel downgrade help, if, to which version?

Also for some Reason the librealsense2.so file in /usr(/local)/lib/ is missing.

Is there anything i could try to fix this?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jun 10, 2020

Hi @DieProgrammIDE I had an Ubuntu 20.04 case earlier this month. The user successfully installed Librealsense on their 20.04 machine using a "backend" installation process that requires an internet connection but is not dependent on Linux versions or kernel versions and does not need patching.

They reported that other than the video stream seeming slightly less stable than the patch-based installation method, there were minimal performance issues as far as they could tell from the testing that they had done.

#6368 (comment)

@DieProgrammIDE
Copy link
Author

DieProgrammIDE commented Jun 11, 2020

I will see into that! Thank you for your fast response

@malapatiravi
Copy link

@MartyG-RealSense I compiled librealsense SDK 2.35.2 and installed in ubuntu20.04 everything is working fine(even though with some glitches that are expected) except that import pyrealsense2 in python is not working? Any information why ? thanks for your help.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jun 15, 2020

@malapatiravi I just answered another case where a RealSense user had problems installing pyrealsense2 from source on Ubuntu 20.04. My reply is here:

#6296 (comment)

@malapatiravi
Copy link

@MartyG-RealSense I used the following config

cmake ../ -DFORCE_RSUSB_BACKEND=true -DBUILD_PYTHON_BINDINGS=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true
but still the python is not working.
Following is the installation result.

-- Install configuration: "release" -- Installing: /usr/local/lib/librealsense2.so.2.35.2 -- Installing: /usr/local/lib/librealsense2.so.2.35 -- Installing: /usr/local/lib/librealsense2.so -- Up-to-date: /usr/local/include/librealsense2 -- Installing: /usr/local/include/librealsense2/rs_advanced_mode.h -- Installing: /usr/local/include/librealsense2/rs.h -- Installing: /usr/local/include/librealsense2/rsutil.h -- Installing: /usr/local/include/librealsense2/rs.hpp -- Up-to-date: /usr/local/include/librealsense2/h -- Installing: /usr/local/include/librealsense2/h/rs_frame.h -- Installing: /usr/local/include/librealsense2/h/rs_types.h -- Installing: /usr/local/include/librealsense2/h/rs_record_playback.h -- Installing: /usr/local/include/librealsense2/h/rs_pipeline.h -- Installing: /usr/local/include/librealsense2/h/rs_processing.h -- Installing: /usr/local/include/librealsense2/h/rs_advanced_mode_command.h -- Installing: /usr/local/include/librealsense2/h/rs_device.h -- Installing: /usr/local/include/librealsense2/h/rs_sensor.h -- Installing: /usr/local/include/librealsense2/h/rs_context.h -- Installing: /usr/local/include/librealsense2/h/rs_option.h -- Installing: /usr/local/include/librealsense2/h/rs_config.h -- Installing: /usr/local/include/librealsense2/h/rs_internal.h -- Up-to-date: /usr/local/include/librealsense2/hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_device.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_frame.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_options.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_context.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_types.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_sensor.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_export.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_serializable_device.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_internal.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_record_playback.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_processing.hpp -- Installing: /usr/local/include/librealsense2/hpp/rs_pipeline.hpp -- Installing: /usr/local/include/librealsense2/rs_advanced_mode.hpp -- Installing: /usr/local/lib/cmake/realsense2/realsense2Targets.cmake -- Installing: /usr/local/lib/cmake/realsense2/realsense2Targets-release.cmake -- Installing: /usr/local/lib/cmake/realsense2/realsense2Config.cmake -- Installing: /usr/local/lib/cmake/realsense2/realsense2ConfigVersion.cmake -- Installing: /usr/local/lib/pkgconfig/realsense2.pc -- Installing: /usr/local/lib/librealsense-file.a -- Installing: /usr/local/lib/pyrealsense2.cpython-38-x86_64-linux-gnu.so.2.35.2 -- Installing: /usr/local/lib/pyrealsense2.cpython-38-x86_64-linux-gnu.so.2.35 -- Set runtime path of "/usr/local/lib/pyrealsense2.cpython-38-x86_64-linux-gnu.so.2.35.2" to "" -- Installing: /usr/local/lib/pyrealsense2.cpython-38-x86_64-linux-gnu.so -- Installing: /usr/local/lib/pybackend2.cpython-38-x86_64-linux-gnu.so.2.35.2 -- Installing: /usr/local/lib/pybackend2.cpython-38-x86_64-linux-gnu.so.2 -- Installing: /usr/local/lib/pybackend2.cpython-38-x86_64-linux-gnu.so -- Up-to-date: /usr/local/include/GLFW -- Installing: /usr/local/include/GLFW/glfw3native.h -- Installing: /usr/local/include/GLFW/glfw3.h -- Installing: /usr/local/lib/cmake/glfw3/glfw3Config.cmake -- Installing: /usr/local/lib/cmake/glfw3/glfw3ConfigVersion.cmake -- Installing: /usr/local/lib/cmake/glfw3/glfw3Targets.cmake -- Installing: /usr/local/lib/cmake/glfw3/glfw3Targets-release.cmake -- Installing: /usr/local/lib/pkgconfig/glfw3.pc -- Installing: /usr/local/lib/libglfw3.a -- Installing: /usr/local/lib/librealsense2-gl.so.2.35.2 -- Installing: /usr/local/lib/librealsense2-gl.so.2.35 -- Set runtime path of "/usr/local/lib/librealsense2-gl.so.2.35.2" to "" -- Installing: /usr/local/lib/librealsense2-gl.so -- Installing: /usr/local/include/librealsense2-gl/rs_processing_gl.h -- Installing: /usr/local/include/librealsense2-gl/rs_processing_gl.hpp -- Installing: /usr/local/lib/cmake/realsense2-gl/realsense2-glTargets.cmake -- Installing: /usr/local/lib/cmake/realsense2-gl/realsense2-glTargets-release.cmake -- Installing: /usr/local/lib/cmake/realsense2-gl/realsense2-glConfig.cmake -- Installing: /usr/local/lib/cmake/realsense2-gl/realsense2-glConfigVersion.cmake -- Installing: /usr/local/lib/pkgconfig/realsense2-gl.pc -- Installing: /usr/local/bin/rs-hello-realsense -- Set runtime path of "/usr/local/bin/rs-hello-realsense" to "" -- Installing: /usr/local/bin/rs-software-device -- Set runtime path of "/usr/local/bin/rs-software-device" to "" -- Installing: /usr/local/bin/rs-capture -- Set runtime path of "/usr/local/bin/rs-capture" to "" -- Installing: /usr/local/bin/rs-callback -- Set runtime path of "/usr/local/bin/rs-callback" to "" -- Installing: /usr/local/bin/rs-save-to-disk -- Set runtime path of "/usr/local/bin/rs-save-to-disk" to "" -- Installing: /usr/local/bin/rs-multicam -- Set runtime path of "/usr/local/bin/rs-multicam" to "" -- Installing: /usr/local/bin/rs-pointcloud -- Set runtime path of "/usr/local/bin/rs-pointcloud" to "" -- Installing: /usr/local/bin/rs-align -- Set runtime path of "/usr/local/bin/rs-align" to "" -- Installing: /usr/local/bin/rs-align-advanced -- Set runtime path of "/usr/local/bin/rs-align-advanced" to "" -- Installing: /usr/local/bin/rs-sensor-control -- Set runtime path of "/usr/local/bin/rs-sensor-control" to "" -- Installing: /usr/local/bin/rs-measure -- Set runtime path of "/usr/local/bin/rs-measure" to "" -- Installing: /usr/local/bin/rs-depth -- Set runtime path of "/usr/local/bin/rs-depth" to "" -- Installing: /usr/local/bin/rs-color -- Set runtime path of "/usr/local/bin/rs-color" to "" -- Installing: /usr/local/bin/rs-distance -- Set runtime path of "/usr/local/bin/rs-distance" to "" -- Installing: /usr/local/bin/rs-post-processing -- Set runtime path of "/usr/local/bin/rs-post-processing" to "" -- Installing: /usr/local/bin/rs-record-playback -- Set runtime path of "/usr/local/bin/rs-record-playback" to "" -- Installing: /usr/local/bin/rs-motion -- Set runtime path of "/usr/local/bin/rs-motion" to "" -- Installing: /usr/local/bin/rs-gl -- Set runtime path of "/usr/local/bin/rs-gl" to "" -- Installing: /usr/local/bin/rs-pose -- Set runtime path of "/usr/local/bin/rs-pose" to "" -- Installing: /usr/local/bin/rs-pose-predict -- Set runtime path of "/usr/local/bin/rs-pose-predict" to "" -- Installing: /usr/local/bin/rs-pose-and-image -- Set runtime path of "/usr/local/bin/rs-pose-and-image" to "" -- Installing: /usr/local/bin/rs-trajectory -- Set runtime path of "/usr/local/bin/rs-trajectory" to "" -- Installing: /usr/local/bin/rs-ar-basic -- Set runtime path of "/usr/local/bin/rs-ar-basic" to "" -- Installing: /usr/local/bin/rs-ar-advanced -- Set runtime path of "/usr/local/bin/rs-ar-advanced" to "" -- Installing: /usr/local/bin/rs-tracking-and-depth -- Set runtime path of "/usr/local/bin/rs-tracking-and-depth" to "" -- Installing: /usr/local/bin/rs-convert -- Set runtime path of "/usr/local/bin/rs-convert" to "" -- Installing: /usr/local/bin/rs-enumerate-devices -- Set runtime path of "/usr/local/bin/rs-enumerate-devices" to "" -- Installing: /usr/local/bin/rs-fw-logger -- Set runtime path of "/usr/local/bin/rs-fw-logger" to "" -- Installing: /usr/local/bin/rs-terminal -- Set runtime path of "/usr/local/bin/rs-terminal" to "" -- Installing: /usr/local/bin/rs-record -- Set runtime path of "/usr/local/bin/rs-record" to "" -- Installing: /usr/local/bin/rs-fw-update -- Set runtime path of "/usr/local/bin/rs-fw-update" to "" -- Installing: /usr/local/bin/rs-data-collect -- Set runtime path of "/usr/local/bin/rs-data-collect" to "" -- Installing: /usr/local/bin/realsense-viewer -- Set runtime path of "/usr/local/bin/realsense-viewer" to "" -- Installing: /usr/local/bin/rs-depth-quality -- Set runtime path of "/usr/local/bin/rs-depth-quality" to "" -- Installing: /usr/local/bin/rs-rosbag-inspector -- Set runtime path of "/usr/local/bin/rs-rosbag-inspector" to "" -- Installing: /usr/local/bin/rs-benchmark -- Set runtime path of "/usr/local/bin/rs-benchmark" to "" -- Installing: /usr/local/lib/libfw.a

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jun 15, 2020

The log seems to indicate that pyrealsense2 was installed.

image

Have you tried testing it with a simple pyrealsense2 example script in Python 3.8, please?

@malapatiravi
Copy link

@MartyG-RealSense Yes. Here is the script i used.
`import pyrealsense2 as rs
import numpy as np
import cv2

ctxt = rs.context()

dev_list = ctxt.query_devices()

n = len(dev_list)
print("number of devices : "+str(n))`
and the log

`malz@malz:/mnt/data/eve/camera_issue$ python3 cam1.py
Traceback (most recent call last):
File "cam1.py", line 1, in
import pyrealsense2 as rs
ModuleNotFoundError: No module named 'pyrealsense2'

malz@malz:/mnt/data/eve/camera_issue$
`

@MartyG-RealSense
Copy link
Collaborator

Have you placed copies of the librealsense2.so and pyrealsense2.so files in the same folder where your test script is located?

As you are using Python 3, the pyrealsense2.so file may have a longer name than it would in Python 2. Please look in librealsense > build > wrappers > python for this file.

Going to this folder should also show whether the Python wrapper has been successfully installed.

#3062 (comment)

@MartyG-RealSense
Copy link
Collaborator

Case closed due to no further comments received.

@cedrusx
Copy link

cedrusx commented Jul 21, 2020

Hi @MartyG-RealSense , is there a timeline of officially supporting Ubuntu 20.04? Thanks.

@MartyG-RealSense
Copy link
Collaborator

@cedrusx I don't have that information, but somebody asked the same question yesterday. So it may be worth following that case to see the reply that gets posted when it is answered.

#6866

@hyperdrive
Copy link

Hi,
I seem to get into issues when compiling python on 20.04 as well. I don't come as far as malapatiravi above:

$ cmake ../ -DFORCE_RSUSB_BACKEND=true -DBUILD_PYTHON_BINDINGS=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true
-- Internet connection identified
-- Info: REALSENSE_VERSION_STRING=2.36.0
-- Setting Unix configurations
-- using RS2_USE_LIBUVC_BACKEND
CMake Error at wrappers/python/third_party/pybind11/tools/FindPythonLibsNew.cmake:95 (message):
Python config failure:

Traceback (most recent call last):

File "<string>", line 1, in <module>

ModuleNotFoundError: No module named 'distutils'

python3-distutils is installed. What more is needed?

@MartyG-RealSense
Copy link
Collaborator

Hi @hyperdrive On another 20.04 case, a RealSense user posted the 20.04 + Python method that worked for them:

#6436 (comment)

@hyperdrive
Copy link

hyperdrive commented Jul 22, 2020

@MartyG-RealSense Yes, I know. I'm trying to follow this path too, but I fail on the cmake configuration so I thought that maybe this was a known issue which could be easily avoided.

Do you have any plans for supporting python 3.8 and ubuntu 20.04? Because it would make the device I bought look so much more attractive. :)

I've tweaked the cmake files to work for me so that the python libraries are built, but there are several warnings and even when the system reports the files were properly installed and I can "import pyrealsense2 as rs", the import is empty and doesn't contain attributes.

cmake tweat (ugly!):
diff --git a/wrappers/python/third_party/pybind11/tools/FindPythonLibsNew.cmake b/wrappers/python/third_party/pybind11/tools/FindPythonLibsNew.cmake
index ad3ed48fa..8e4f0f3ab 100644
--- a/wrappers/python/third_party/pybind11/tools/FindPythonLibsNew.cmake
+++ b/wrappers/python/third_party/pybind11/tools/FindPythonLibsNew.cmake
@@ -79,7 +79,7 @@ print('.'.join(str(v) for v in sys.version_info));
 print(sys.prefix);
 print(s.get_python_inc(plat_specific=True));
 print(s.get_python_lib(plat_specific=True));
-print(s.get_config_var('SO'));
+print(s.get_config_var('EXT_SUFFIX'));
 print(hasattr(sys, 'gettotalrefcount')+0);
 print(struct.calcsize('@P'));
 print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION'));
@@ -90,18 +90,30 @@ print(s.get_config_var('MULTIARCH') or '');
     OUTPUT_VARIABLE _PYTHON_VALUES
     ERROR_VARIABLE _PYTHON_ERROR_VALUE)
 
-if(NOT _PYTHON_SUCCESS MATCHES 0)
-    if(PythonLibsNew_FIND_REQUIRED)
-        message(FATAL_ERROR
-            "Python config failure:\n${_PYTHON_ERROR_VALUE}")
-    endif()
-    set(PYTHONLIBS_FOUND FALSE)
-    return()
-endif()
+SET (_PYTHON_VALUES "3.8.2.final.0
+/usr
+/usr/include/python3.8
+/usr/lib/python3/dist-packages
+.cpython-38-x86_64-linux-gnu.so
+0
+8
+3.8
+/usr/lib
+x86_64-linux-gnu
+")
+#if(NOT _PYTHON_SUCCESS MATCHES 0)
+#    if(PythonLibsNew_FIND_REQUIRED)
+#        message(FATAL_ERROR
+#            "Python config failure:\n${_PYTHON_ERROR_VALUE}")
+#    endif()
+#    set(PYTHONLIBS_FOUND FALSE)
+#    return()
+#endif()
 
 # Convert the process output into a list
-string(REGEX REPLACE ";" "\\\\;" _PYTHON_VALUES ${_PYTHON_VALUES})
-string(REGEX REPLACE "\n" ";" _PYTHON_VALUES ${_PYTHON_VALUES})
+#string(REGEX REPLACE ";" "\\\\;" _PYTHON_VALUES "${_PYTHON_VALUES}")
+string(REGEX REPLACE "\n" ";" _PYTHON_VALUES "${_PYTHON_VALUES}")
+message(STATUS "__PYTHON_VALUES= ${_PYTHON_VALUES}")
 list(GET _PYTHON_VALUES 0 _PYTHON_VERSION_LIST)
 list(GET _PYTHON_VALUES 1 PYTHON_PREFIX)
 list(GET _PYTHON_VALUES 2 PYTHON_INCLUDE_DIR)

Python files are installed as :
-- Installing: /usr/lib/python3/dist-packages/pyrealsense2/pybackend2.cpython-38-x86_64-linux-gnu.so.2.36.0
-- Installing: /usr/lib/python3/dist-packages/pyrealsense2/pybackend2.cpython-38-x86_64-linux-gnu.so.2
-- Installing: /usr/lib/python3/dist-packages/pyrealsense2/pybackend2.cpython-38-x86_64-linux-gnu.so
-- Installing: /usr/lib/python3/dist-packages/pyrealsense2/pyrealsense2.cpython-38-x86_64-linux-gnu.so.2.36.0
-- Installing: /usr/lib/python3/dist-packages/pyrealsense2/pyrealsense2.cpython-38-x86_64-linux-gnu.so.2.36
-- Set runtime path of "/usr/lib/python3/dist-packages/pyrealsense2/pyrealsense2.cpython-38-x86_64-linux-gnu.so.2.36.0" to ""

I suppose there are more subtle differences between 2.7 and 3.8 which makes this more difficult.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 23, 2020

Hi @hyperdrive The Python bindings can be built from source code on Python 3.8. I also filed an official feature request with Intel in June 2020 for the creation of PyPi pip install packages for Python 3.8.

In regard to official 20.04 support, it will likely be a natural progression for Librealsense to do so at some point but I do not have any information yet about a timeline for that. In the meantime, the RSUSB backend installation method seems to work fine for installing the core Librealsense on its own but seems to encounter complications when building Librealsense with Python binding support using CMake.

I believe that in some cases, the Python bindings have installed to Python 2.7 when they should have been installed for Python 3.x. When Python 2 and 3 are both installed on the same computer, you can add a flag to the CMake build statement called -DPYTHON_EXECUTABLE to force building bindings for a specific Python installation. It does not always work, though some have had success with this method.

#6449 (comment)

Overall, if your computer / computing device has an x86 or x64 processor (not Arm), it may be easier to build the bindings using Python 3.7 and pip install pyrealsense2 until pip packages for Python 3.8 are available.

@hyperdrive
Copy link

Ok, so I noted that if I copy the so files to the same directory where where my python files are it works. I'm thinking that maybe it wasn't "installed" properly when it was copied to /usr/lib/python3/dist-packages/pyrealsense2 [..] using "make install". Anyway, I can live with moving the so files around to my project directories until I figure out how to make them available globally.

@MartyG-RealSense
Copy link
Collaborator

Thanks very much @hyperdrive for updating about the workaround solution that you found. Good luck!

@hyperdrive
Copy link

Nw. This is what we have open source for, right? Since I will have the same issues getting OpenVINO and Movidius to run it seems I need to setup a dedicated Ubuntu 18 workstation. It's a bit troublesome that Google is pushing for bleeding edge distribution and Intel is using yesterdays platforms. It makes it very complicated to prepare a workstation which can perform experiments across various solutions. Please consider supporting Ubuntu 20.04 ! :)

@matanox
Copy link

matanox commented Jan 25, 2021

Just wondering if 20.04 still requires very special handling for getting up and running with RealSense. There appears to be a somewhat official-looking procedure for setting up on 20.04 here. Have you experienced stability on 20.04 at par with RealSense used on older versions of Ubuntu?

@MartyG-RealSense
Copy link
Collaborator

Hi @matanster Official support for Ubuntu 20 Focal was introduced in librealsense version 2.40.0. The release notes in the link below will hopefully help to answer your questions.

https://github.com/IntelRealSense/librealsense/wiki/Release-Notes#release-2400

Installation information for 20.04 have been added to the link that you quoted, which is indeed the official Linux installation documentation.

@matanox
Copy link

matanox commented Jan 25, 2021

Thanks a lot for this extended support. A small note arising in my installation might be that the kernel headers brought in by the apt installation are a newer kernel version than the kernel used on my constantly updating 20.04 as of today. The installation brings in headers for 5.4.0-64 whereas my up-to-date Ubuntu 20.04 still uses 5.4.0-62. This actually prevents the installation from finalizing due to the following natural consequence:

Module build for kernel 5.4.0-62-generic was skipped since the kernel headers for this kernel does not seem to be installed.

I will further review the meaning of this difference.

@MartyG-RealSense
Copy link
Collaborator

You are very welcome!

If librealsense is built with the RSUSB method mentioned in the release notes then it can be installed without dependence on Linux versions or kernel versions and without the need for patching.

@matanox
Copy link

matanox commented Jan 25, 2021

Thanks for the impeccable support. It seems that after rebooting with today's 20.04 automatic updates having run, 5.4.0-64 is now my kernel version just the same as the header files brought in during the RealSense apt package installation, and my kernel version now has the realsense tag in its name indicating that the installation is probably good to go. Sweet.

I understand that without downgrading to the RSUSB mode, there may be some frames loss, but will wait and see whether that is a real issue for my scenario before making a custom build for RSUSB.

@MartyG-RealSense
Copy link
Collaborator

Great to hear that your kernel updated successfully! Feel free to create a new case on this forum if you do have any questions or problems. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants