cx_Freeze + Phidget22 on Linux: libphidget22.so not found

Supporting 2.7 and 3.2+
Welson
Fresh meat
Posts: 3
Joined: Fri Oct 03, 2025 3:49 am

cx_Freeze + Phidget22 on Linux: libphidget22.so not found

Post by Welson »

Hey,

I’m working on a control tool that uses Phidget22 to handle some hardware. Everything runs fine when I launch it with Python (Ubuntu 22.04, Python 3.10), but once I freeze it with cx_Freeze, the binary crashes at startup with:

Code: Select all

Failed to load dynlib/dll 'libphidget22.so'
The library is installed via apt and works perfectly when running the script directly. The issue only happens with the frozen build.

Here’s the setup.py I’m using:

Code: Select all

from cx_Freeze import setup, Executable

build_exe_options = {
"packages": ["Phidget22", "asyncio", "logging", "requests", "json"],
"include_files": [
("/usr/lib/libphidget22.so", "libphidget22.so"),
("config.json", "config.json"),
],
}

setup(
name="control_center",
version="1.4.2",
description="Hardware monitoring tool using Phidget22",
author="Engineering Team",
options={"build_exe": build_exe_options},
executables=[Executable("main.py", target_name="control_center")],
)
Even when launching with LD_LIBRARY_PATH=. or directly from the build folder, the library still isn’t found.
Everything else works fine, except for the part that communicates with the Phidget devices.

Has anyone run into this with cx_Freeze on Linux?