Opened 5 years ago

Closed 4 years ago

#4235 closed defect (fixed)

RealSense camera interface pyrealsense2 not available for Python 3.8

Reported by: Tom Goddard Owned by: Tom Goddard
Priority: moderate Milestone:
Component: VR Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The pyrealsense2 PyPi module used by our RealSense camera tool for capturing augmented reality videos is only available for Python 3.7, so will not work in current ChimeraX which uses Python 3.8.

Requests made on the RealSense library github site for Python 3.8 are more than a year old, and the response from Intel is repeatedly "we support RealSense on Python" and "no further info on when Python 3.8 may be supported".

https://github.com/IntelRealSense/librealsense/issues/6126

https://github.com/IntelRealSense/librealsense/issues/6296

https://github.com/IntelRealSense/librealsense/issues/8229

The RealSense C/C++ library and Python wrapper are open source and could possibly be compiled. Uses cmake and pybind11 for the Python wrapper. Might be able to just build the Python wrapper using the C++ library from the PyPi 3.7 version which is pretty recent (December 2020).

Change History (2)

comment:1 by Tom Goddard, 5 years ago

I compiled pyrealsense2 for Python 3.8 and the realsense2.dll from GitHub source code on my home Windows 10 machine with Microsoft Visual Studio 2017 and cmake. Worked in by ChimeraX 1.2 developer build. Shell commands (in cygwin bash shell) below. The libraries could be included with the ChimeraX RealSense library if Intel does not put Python 3.8 wheels on PyPi.

In testing the Python 3.8 pyrealsense2 it froze repeatedly in 3 tests, even at 640 x 480 resolution, using 6 foot cable to usbc, no VR. On each test I also tested Chimera 1.1 pyrealsense2 in the same way and it too froze every time within 30 seconds. So the newer version (2.41.0) I compiled is no more reliable then the PyPi Python 3.7 version (2.35.2.1937). There must be some special magic because I used the 1.1 version two days ago for 15 minutes with Vive Pro VR without any freeze.

git clone https://github.com/IntelRealSense/librealsense.git
cd librealsense
mkdir build
cd build

# TM2 option is for T265 tracking camera support, not needed.
/cygdrive/c/Program\ Files/CMake/bin/cmake.exe .. -G "Visual Studio 15 2017 Win64" -DPYTHON_EXECUTABLE="C:/Users/goddard/AppData/Local/Programs/Python/Python38/python.exe" -DBUILD_PYTHON_BINDINGS=true -DPYBIND11_PYTHON_VERSION=3.8 -DBUILD_UNIT_TESTS=false -DBUILD_EXAMPLES=false -DBUILD_GRAPHICAL_EXAMPLES=false -DBUILD_WITH_TM2=false -DCHECK_FOR_UPDATES=true

/cygdrive/c/Program\ Files/CMake/bin/cmake.exe --build . --config Release -- -m

cd Release
cp -r /cygdrive/C/Users/goddard/AppData/Local/UCSF/ChimeraX/1.1/site-packages/pyrealsense2 /cygdrive/C/Users/goddard/AppData/Local/UCSF/ChimeraX/1.2/site-packages
cp -p *.pyd *.dll /cygdrive/C/Users/goddard/AppData/Local/UCSF/ChimeraX/1.2/site-packages/pyrealsense2/

comment:2 by Tom Goddard, 4 years ago

Resolution: fixed
Status: assignedclosed

Python 3.8 and 3.9 versions were made available on PyPi.

Note: See TracTickets for help on using tickets.