LabJackPython for UD, Exodriver, U12 - Windows, Mac, Linux
LabJackPython is our cross-platform Python module for communicating with the LabJack U3, U6, UE9, and U12. It works on Windows with the UD Driver and U12 Driver, and on Linux and macOS with the Exodriver. For the LJM library (T7, T4, and Digit), use Python_LJM.
Subsections
Examples
For LabJackPython examples, please see the Examples directory in the LabJackPython download, or see on GitHub:
https://github.com/labjack/LabJackPython/tree/master/Examples
Download
The latest release of LabJackPython is 2.1.0 from November 3, 2022: Download the 2.1.0 release of LabJackPython.
For the latest development version, archived versions and code repository, visit LabJackPython on GitHub.
LabJackPython 2.0.4 and later versions are available using pip via PyPI.
Requirements
Python 2.7 and 3.x for the latest LabJackPython release.
Install the appropriate driver:
On Windows, install the UD Driver for a UD device or install the U12 Driver for a U12.
On Linux and macOS, install the Exodriver.
If using Modbus, make sure your LabJack meets the minimum firmware requirement mentioned in the Modbus Support table on the UD Modbus page.
Install
To control UD devices using Python, the LabJackPython Python package and the UD Driver or Exodriver must be installed.
if pip is available, the latest LabJackPython package can be downloaded by navigating to a command line and running:
python -m pip install LabJackPython
or:
pip install LabJackPython
LabJackPython can also be downloaded from our source archives. Unzip the LabJackPython.zip file and open a terminal/command prompt. In the terminal, use the command line to go to the unzipped LabJackPython directory (e.g., “cd Desktop/LabJackPython”). Then run one of the following commands to install the LabJackPython modules:
Windows
python setup.py install
Linux and macOS
$ sudo python setup.py install
Note the LabJackPython zip file and unzipped directory name will vary on the download.
Windows Troubleshooting
If running the above command causes a "'python' is not recognized as an internal or external command, operable program or batch file." or similar error, that means either Python is not installed on your computer or the Python executable's path was not added to the Windows user or system path. To help resolve this issue, please run the Python Windows installer and in the "Customize Python" window, click the "Add python.exe to Path" option towards the bottom and select "Will be installed on local hard drive".
Then finish the Python installation. Open a new terminal/console window and then go through our LabJackPython installation instructions again.
Alternatively, after Python is installed you can run the Python executable from its path. For example:
C:\Python27\python.exe setup.py install
Note that the above command uses the Python 2.7 path, and you should use the correct path on your computer which may differ.
Another option is to manually add the Python executable's path to the Windows path as described in the Python documentation.
Known Issues
macOS: As of macOS 10.15, opening a U6 the first time after plugging it in sometimes fails. Subsequent attempts to open succeed.
Documentation
For documentation, please refer to the docstrings in the source code or use the help function on the module, class, or method.
For the U3, refer to its u3.py source, or use the “help(u3)” call in Python (“import u3” beforehand).
For the U6, refer to its u6.py source, or use the “help(u6)” call in Python (“import u6” beforehand).
For the UE9, refer to its ue9.py source, or use the “help(ue9)” call in Python (“import ue9” beforehand).
For the U12, refer to its u12.py source, or use the “help(u12)” call in Python (“import u12” beforehand).
Quickstart
LabJackPython provides both a Modbus and low-level command interface for performing operations on a LabJack device. Quickstarts can be found for both in the Modbus Quickstart and Low-level Commands Quickstart sections.