pyrealsense2-mac

Python Wrapper for Intel Realsense SDK 2.0.


Keywords
macos, pyrealsense2, realsense, realsense-python, realsense2
License
Apache-2.0
Install
pip install pyrealsense2-mac==2.54.1

Documentation

pyrealsense2 for macOS

English | 简体中文

MacOS Build MacOS Test PyPI

Prebuilt pyrealsense2 packages of the librealsense library for macOS as an addition to the PyPI prebuilt packages by Intel.

Prebuilt

To install the prebuilt wheel packages from this repository, run the following command (macOSX librealsense is included):

pip install pyrealsense2-mac

Supported Platforms & Versions

  • OS: macOS 13+ (Big Sur)
  • Architecture: Intel (x86_64), Apple Silicon (arm64)
  • Python: 3.10

requirements.txt

To use pyrealsense2 in a requirements.txt in combination with pyrealsense2-mac use the following lines. This will install either the official Windows / Linux version or the MacOSX pre-built wheel package.

pyrealsense2; platform_system == "Windows" or platform_system == "Linux"
pyrealsense2-mac; platform_system == "Darwin"

No need Sudo

To run realsense-viewer, use the following command:

realsense-viewer

Manual Build

Prerequisites

Install homebrew and the following packages:

sudo xcode-select --install
brew install cmake pkg-config openssl
brew install python@3.10

And set up a new python virtual environment:

python3 -m venv venv
source venv/bin/activate

Build

Run the build script in your preferred shell.

bash build.sh

Build for a specific macos version, default is 13:

bash build.sh -m 11

It is possible to set the tag version to build older releases, default is v2.54.1:

bash build.sh -t v2.51.1

The prebuild wheel files are copied into the ./dist directory. By default, the dylib is added to the wheel file with the delocate toolkit. It is possible to disable this behaviour for just the python build:

bash build.sh --disable-delocate

Multi-Architecture Packages

The build script creates binaries which are targeted to arm64 and x86_64. At the moment I could not find a way to tell the wheel package to set a universal tag. For now it is just possible to rename the wheel and change the architecture to the other platform and the package will work there too.

Installation

To install the wheel package just use the default pip install command.

pip install pyrealsense2_mac-2.54.1-cp310-cp310-macosx_13_universal2.whl

License

MIT License