Python Setup
The UDP sample ships Python scripts. You run them from a terminal, alongside Unity — they are not part of the Unity project and Unity never executes them.
What the scripts need
The sample needs nothing beyond Python itself. stream_imu.py, run_recordings.py and imu_sensors.py use only the standard library — sockets, CSV reading, file paths. There is nothing to install and no virtual environment to create.
Two optional tools that ship in the LABO package rather than the sample do need one package:
| Script | Needs |
|---|---|
stream_imu.py — stream a recording | nothing |
run_recordings.py — pick a recording interactively | nothing |
generate_ymca_imu.py — regenerate the sample data | numpy |
estimate_imu_heading.py — estimate the heading offset | numpy |
Install that one only if you need those:
pip install numpy
Installing Python
Windows. Download from python.org/downloads, or install from the Microsoft Store. During the python.org installer, tick Add python.exe to PATH on the first screen — without it, python is not a command your terminal recognises and every instruction here fails at step one.
macOS. Install from python.org/downloads, or with Homebrew:
brew install python
macOS ships an older Python that is best left alone for system use.
Linux. Python 3 is almost always present. If not, install python3 from your distribution's package manager.
Any Python 3.8 or newer works.
Check it worked
Open a terminal and run:
python --version
You want a 3.x version number. If you get "command not found" or a 2.x version, try python3 --version — on macOS and Linux python3 is usually the right command, and every command in these docs works the same with python3 substituted for python.
If Windows opens the Microsoft Store instead of running Python, the installer's PATH option was skipped. Re-run the installer, choose Modify, and ensure Add python.exe to PATH is ticked. A new terminal window is needed afterwards — an already-open one keeps the old PATH.
Recommended editor
Visual Studio Code is the recommendation. It is free, cross-platform, and handles both halves of this work: the Python you run and the C# in your Unity project. If you already edit Unity scripts in VS Code, you have everything.
Get it from code.visualstudio.com, then add:
- the Python extension (Microsoft) — running scripts, and a built-in terminal
- optionally the C# Dev Kit extension, if you also edit Unity scripts
Open the sample folder with File → Open Folder, then Terminal → New Terminal. The terminal opens in that folder, so python stream_imu.py runs without navigating anywhere.
Alternatives. PyCharm Community Edition is free and excellent if you prefer a dedicated Python IDE. JetBrains Rider is a strong choice if you already use it for Unity — it runs Python through a plugin. Any editor works; none of these scripts require an IDE.
Running from a plain terminal
An editor is convenience, not a requirement. From any terminal:
cd path/to/UDP Body Tracking
python stream_imu.py
On Windows, a quick way to get a terminal in the right place: open the folder in File Explorer, type cmd in the address bar, and press Enter.
Next
With Python working, go to Running the sample.