Install & Compatibility
Where this runs
tested against v1.23.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 18MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.020s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
LJM
✓ import labjack.ljm as ljm
✗ from labjack import ljm
Incorrect import path; 'labjack.ljm' is the correct module.
LJM
✓ from labjack import ljm
Open a LabJack device, write to DAC0, read back, and close.
import labjack.ljm as ljm
# Open first found LabJack device
handle = ljm.openS("ANY", "ANY", "ANY") # returns handle
info = ljm.getHandleInfo(handle)
print(f"Opened a LabJack with device type: {info[0]} connection type: {info[1]} serial number: {info[2]} IP address: {info[3]} port: {info[4]} max bytes per MB: {info[5]}")
# Write and read analog output
ljm.eWriteName(handle, "DAC0", 2.5) # set DAC0 to 2.5V
value = ljm.eReadName(handle, "DAC0")
print(f"DAC0 value: {value}")
ljm.close(handle)
Errors
Common errors & fixes
LJMError: LJM_ERROR_DEVICE_NOT_FOUND
Device not connected or LJM library not installed properly.
fixCheck USB/ethernet connection, ensure device is powered, and verify LJM native library is installed (run 'ljm_install' or see LabJack docs).
ImportError: No module named labjack.ljm
labjack-ljm Python package not installed or wrong import path.
fixInstall with 'pip install labjack-ljm' and import using 'import labjack.ljm as ljm'.
LJMError: LJM_ERROR_INVALID_HANDLE
Device handle is invalid (closed or never opened).
fixEnsure handle is obtained from ljm.openS() and not closed before use.
LJMError: LJM_ERROR_LIBRARY_NOT_FOUND
Native LJM library (liblabjacklm.so or LabJackLM.dll) not found in system library path.
fixInstall the LJM native library from LabJack's website. On Linux, set LD_LIBRARY_PATH to the directory containing the library.
Upgrade
Version history
1.23.0latest on PyPI · released Dec 4, 2023
Audit
Dependencies
No dependency data recorded yet.