GPIB Setup on Windows, Linux, and macOS
Step-by-step driver installation for NI-VISA, Keysight IO Libraries, and linux-gpib. Includes troubleshooting for the most common failures.
Contents
What Is GPIB?
GPIB (General Purpose Interface Bus), also known as IEEE-488 or HP-IB, is a parallel interface standard developed by HP in the late 1960s. It connects instruments to controllers (usually a PC) using a dedicated 24-pin connector and cable.
Despite being decades old, GPIB is still widely used in production test environments because it is extremely reliable, deterministic, and supported by virtually every bench instrument made before 2005. Many lab instruments today still include a GPIB port alongside USB and LAN.
A single GPIB bus supports up to 15 instruments, each assigned a unique address (0–30). Typical instrument addresses are 1–22; address 0 is reserved for the controller.
Hardware Requirements
You'll need
- A GPIB controller (PCI, PCIe, USB, or PCIe adapter) — most commonly a National Instruments GPIB-USB-HS or similar
- A GPIB cable (IEEE-488 24-pin) to connect the controller to the instrument
- The instrument must be powered on before driver installation
Common GPIB controllers and their typical use cases:
- NI GPIB-USB-HS — USB dongle, the most common choice for modern laptops and desktops. Works with NI-VISA on all three operating systems.
- Keysight 82357B — USB adapter, works with Keysight IO Libraries Suite. Slightly faster than NI for Keysight instruments.
- NI PCIe-GPIB — PCI Express card for desktop workstations. Highest throughput for production test.
- Prologix GPIB-USB — Low-cost USB adapter. Supported by pyvisa-py directly without NI-VISA.
Driver Installation by OS
Option A — NI-VISA (Recommended)
NI-VISA is the most widely supported VISA implementation and works with all GPIB controllers from National Instruments.
- Download NI-VISA from the NI downloads page. The free runtime version is sufficient for PyVISA use.
- Run the installer and accept defaults. Reboot when prompted.
- Plug in the GPIB controller (e.g., GPIB-USB-HS). Windows will detect it automatically using the installed driver.
- Open NI MAX (Measurement & Automation Explorer) from the Start menu to confirm the controller appears under Devices and Interfaces.
Option B — Keysight IO Libraries Suite
If you use a Keysight GPIB adapter (82357B, 82350B, etc.), use Keysight's own IO Libraries Suite instead of NI-VISA.
- Download Keysight IO Libraries Suite from the Keysight software page.
- Install and reboot. The Keysight Connection Expert application will open automatically.
- Plug in the GPIB adapter. It will appear in Connection Expert under Instrument I/O on This PC.
Option A — NI-VISA for Linux
National Instruments provides NI-VISA for 64-bit Linux (x86_64). This is the most straightforward path if you already have NI hardware.
- Go to the NI-VISA downloads page and select the Linux version.
- Download the
.rpm(RHEL/Fedora) or.deb(Ubuntu/Debian) package. - Install:
# Ubuntu / Debian
sudo dpkg -i ni-visa_*.deb
sudo apt-get install -f # fix any dependency issues
# RHEL / Fedora
sudo rpm -ivh ni-visa_*.rpm
- Add your user to the
nigroup to allow instrument access without root:
sudo usermod -aG ni $USER
newgrp ni # apply without logging out
Option B — linux-gpib (Open Source)
linux-gpib is an open-source kernel module that supports many GPIB controllers. It requires building from source but works without NI's proprietary software.
- Install build dependencies:
sudo apt-get install linux-headers-$(uname -r) build-essential git
- Clone and build linux-gpib:
git clone https://git.code.sf.net/p/linux-gpib/code linux-gpib
cd linux-gpib/linux-gpib-kernel
make
sudo make install
sudo modprobe ni_usb_gpib # for NI USB controllers
- Configure
/etc/gpib.confwith your controller type, then load the configuration:
sudo gpib_config
- Install the Python bindings:
cd ../linux-gpib-user
./bootstrap && ./configure && make
sudo make install
pip install gpib-ctypes # PyVISA backend for linux-gpib
gpib-ctypes is installed, pyvisa-py will automatically use linux-gpib for GPIB resources. No NI-VISA needed.
Option C — Prologix GPIB-USB (All Linux distros)
The Prologix controller appears as a virtual serial port (/dev/ttyUSBx) and works with pyvisa-py out of the box. No kernel module required.
# Add user to dialout group for serial port access
sudo usermod -aG dialout $USER
newgrp dialout
Then open the instrument in PyVISA using the GPIB-over-serial resource string:
import pyvisa
rm = pyvisa.ResourceManager('@py')
inst = rm.open_resource('GPIB0::22::INSTR',
resource_pyclass=pyvisa.resources.GPIBInstrument)
NI-VISA for macOS
NI-VISA supports macOS 11 (Big Sur) and later on Intel and Apple Silicon (via Rosetta 2).
- Download NI-VISA from the NI downloads page — select the macOS version.
- Open the
.pkginstaller and follow the prompts. An admin password is required. - After installation, open NI MAX from Applications → National Instruments → NI MAX to verify the controller is listed.
- Plug in the GPIB controller (GPIB-USB-HS or similar). It should appear immediately in NI MAX.
Prologix GPIB-USB on macOS
The Prologix adapter requires a USB serial driver. Install the CP210x driver from Silicon Labs if the device doesn't appear in /dev/:
# Verify the device appears after driver installation
ls /dev/tty.usbserial*
# Typical output: /dev/tty.usbserial-0001
Verify with PyVISA
Once the driver is installed and the instrument is connected, use PyVISA to confirm everything works:
import pyvisa
rm = pyvisa.ResourceManager()
resources = rm.list_resources()
print("Found resources:", resources)
# Connect to an instrument at GPIB address 22
inst = rm.open_resource('GPIB0::22::INSTR')
print(inst.query('*IDN?'))
Expected output:
Found resources: ('GPIB0::22::INSTR',)
Keysight Technologies,34461A,MY12345678,A.02.17-02.40-02.17-00.49-03-01
Quick Checklist
- GPIB controller appears in NI MAX or Device Manager
- Instrument is powered on and GPIB cable is connected
- Instrument GPIB address is set correctly (check front panel menu)
rm.list_resources()showsGPIB0::<addr>::INSTR*IDN?returns the instrument identification string
Troubleshooting
GPIB controller not found in NI MAX / Device Manager
Unplug and replug the USB controller. If it still doesn't appear, try a different USB port (avoid hubs). On Windows, open Device Manager and look for unknown devices with a yellow warning icon — right-click and update the driver manually pointing to the NI-VISA installation directory.
list_resources() returns empty — no GPIB devices found
Check the GPIB address on the instrument's front panel (usually under System → I/O → GPIB Address). Default address is often 1 for controllers or 22 for common instruments. Try scanning manually:
import pyvisa
rm = pyvisa.ResourceManager()
# Try a specific address directly if list_resources is empty
inst = rm.open_resource('GPIB0::1::INSTR')
print(inst.query('*IDN?'))
VisaIOError: VI_ERROR_TMO (timeout)
The instrument is not responding within the default timeout. This usually means the GPIB address is wrong, or the instrument is busy. Verify the address on the front panel and increase the timeout:
inst.timeout = 10000 # 10 seconds
Address conflict — multiple instruments not responding correctly
Every instrument on the bus must have a unique GPIB address. If two instruments share the same address, neither will respond reliably. Check and reassign addresses via each instrument's front panel menu (usually System → Interface → GPIB → Address).
Linux: permission denied on GPIB device
With NI-VISA on Linux, ensure your user is in the ni group. With linux-gpib, ensure the group is gpib:
sudo usermod -aG gpib $USER
newgrp gpib
Slow transfer speeds
GPIB transfer speed is limited by the slowest device on the bus. If one old instrument limits bus speed, use inst.visalib.set_attribute to enable T1 delay compensation, or physically remove slow instruments from the chain when doing high-speed transfers.
Next Steps
With GPIB working, explore these resources: