Registry / data / nidaqmx

nidaqmx

JSON →
library1.5.0pypypi✓ verified 84d ago

The `nidaqmx` package provides a Python API for interacting with the NI-DAQmx driver, enabling development of instrumentation, acquisition, and control applications with NI data acquisition (DAQ) devices. It acts as a highly object-oriented wrapper around the NI-DAQmx C API. The library is actively maintained with frequent releases, with the current stable version being 1.4.1.

pip install nidaqmx
INSTALL
IMPORT
SIG · NIDAQMX
N
nidaqmx
datapythonv1.5.0
Install
5.0s avg
Import
756ms
Disk
105MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.5.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
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.765s · 104.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 5.0s · import 0.747s · 101MB
105MB installed
● package 105MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nidaqmx
import nidaqmx
Standard import for the main package.
Task
from nidaqmx import Task
The primary class for DAQ operations.
constants
from nidaqmx import constants
Provides enums for various DAQmx settings (e.g., AcquisitionType, TerminalConfiguration).

This quickstart demonstrates how to perform a single-point analog voltage acquisition. It initializes a DAQmx task, adds an analog input voltage channel, and reads a single sample. Replace 'Dev1/ai0' with the actual physical channel name of your NI DAQ device, which can be found and configured in NI MAX. Ensure the NI-DAQmx driver is installed before running.

import nidaqmx import os # Replace 'Dev1/ai0' with the actual physical channel name of your DAQ device. # You can find device names in NI MAX. For demonstration, we use an env var. # For a simulated device, you might use 'SimulatedDAQ/ai0' after configuring it in NI MAX. PHYSICAL_CHANNEL = os.environ.get('NIDAQMX_DEV_CHANNEL', 'Dev1/ai0') try: with nidaqmx.Task() as task: task.ai_channels.add_ai_voltage_chan(PHYSICAL_CHANNEL) print(f'Reading voltage from {PHYSICAL_CHANNEL}...') data = task.read() print(f'Acquired data: {data} V') except nidaqmx.errors.DaqError as e: print(f"NI-DAQmx Error: {e}") print("Please ensure your NI-DAQmx driver is installed and your device/channel name is correct in NI MAX.") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingPython 3.9 support was temporarily removed in `1.4.0.dev0` but restored in subsequent `1.4.0.dev1` and `1.4.0` releases. While current versions (`1.4.1`) support Python 3.9+, users on specific pre-release versions of 1.4.0 might have encountered compatibility issues with Python 3.9.
fix
Upgrade to `nidaqmx==1.4.0` or later for Python 3.9+ compatibility. Always check `requires_python` in PyPI for the specific version you install.
affects: 1.4.0.dev0
gotchaThe `nidaqmx` Python package requires a separate installation of the NI-DAQmx driver. The Python package is a wrapper around this driver, and will not function without it.
fix
Download and install the latest NI-DAQmx driver from ni.com/downloads. On Windows, you can also try `python -m nidaqmx installdriver` as a convenience command, but direct installation is recommended.
affects: All versions
gotchaFor continuous or high-speed data acquisition, directly using `task.read()` in a loop can lead to performance issues and `DaqError` exceptions (e.g., 'application is not able to keep up with the hardware acquisition').
fix
Utilize `nidaqmx.stream_readers` classes (e.g., `AnalogMultiChannelReader`) with pre-allocated NumPy arrays for improved performance in continuous acquisition scenarios.
affects: All versions
gotchaFailing to explicitly close `nidaqmx.Task` objects can lead to `DaqResourceWarning` messages and potential resource leaks or conflicts. This is especially true if not using the `with` statement.
fix
Always use a `with nidaqmx.Task() as task:` block to ensure tasks are properly initialized and closed, even in case of exceptions. If not using `with`, call `task.close()` explicitly.
affects: All versions
Errors
Common errors & fixes
nidaqmx.errors.DaqError: The application is not able to keep up with the hardware acquisition. Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem. Status Code: -200279
The Python application cannot process or retrieve data from the DAQ device's buffer fast enough, leading to buffer overflows.
fix
Increase the DAQmx task buffer size (`task.timing.cfg_samp_clk_timing(..., samps_per_chan=...)`), read data more frequently, or switch to `nidaqmx.stream_readers` with NumPy arrays for better performance. Ensure you're not trying to read all available samples if the buffer is continuously filling.
nidaqmx.errors.DaqResourceWarning: Task of name "_unnamedTask<0>" was not explicitly closed before it was destructed.
An `nidaqmx.Task` object was created but its `close()` method was not explicitly called before the object was garbage collected, potentially leading to resource leaks.
fix
Wrap DAQmx task operations in a `with nidaqmx.Task() as task:` statement. This ensures proper resource management and task closure, even if errors occur. If not using `with`, ensure `task.close()` is called manually in a `finally` block.
nidaqmx.errors.DaqError: The specified resource is reserved. The operation could not be completed as specified.
Another application or an existing (possibly unclosed) DAQmx task is currently holding exclusive access to the DAQ device or a specific channel.
fix
Ensure all previous DAQmx tasks are properly closed. Restarting the Python script or even the system can sometimes resolve this if a task was not gracefully terminated. Check NI MAX to see if any tasks are running or if the device is reserved.
nidaqmx.errors.DaqError: Buffer is too small to fit read data. Status Code: -200229
The buffer allocated for reading data (e.g., a NumPy array passed to `read_many_sample`) is not large enough to hold the number of samples requested.
fix
Increase the size of the buffer (e.g., the NumPy array) you are providing to the read method, ensuring it can accommodate `number_of_samples_per_channel` across all channels being read. Also, ensure the array shape is correct if `verify_array_shape` is enabled on `stream_readers`.
Upgrade
Version history
1.5.0latest on PyPI · released Apr 23, 2026
Audit
Dependencies
NI-DAQmx driverrequiredRequired for the Python API to function; must be installed separately. The `nidaqmx` package is a wrapper around the C API provided by this driver.
numpyoptionalUsed for efficient handling of acquired data, especially with stream readers for performance-critical applications.
hightimeoptionalA dependency that was updated in recent versions.
nitypesoptionalUpdated in recent versions, crucial for certain type definitions.
clickoptionalDependency related to command-line interface utilities shipped with the package.
Agent activity
4 hits · last 30 days
node
4
Resources
nidaqmx — pip install nidaqmx · libregistry