PyVISA
PyVISADocs

Windows Setup

How to install PyVISA on Windows with NI-VISA or Keysight IO Libraries drivers, virtual environments, and corporate proxy configuration.

PyVISA working on Windows with NI-VISA in 10 minutes.

Quick Start

# 1. Download and install NI-VISA from ni.com (registration required)
# 2. Install PyVISA
pip install pyvisa psutil zeroconf

# 3. Verify
python -c "import pyvisa; print(pyvisa.ResourceManager().list_resources())"

Step-by-Step Installation

Download the NI-VISA Driver

NI-VISA is the most tested VISA backend for PyVISA. Register at ni.com, then download the NI Package Manager.

Install the NI-VISA Driver

The installer will ask you to disable Windows Fast Startup.

Screenshot of Windows Fast Startup disable dialog

Fast Startup on production machines

On a development laptop, Fast Startup won't affect your setup. On production machines, disable it. Fast Startup can prevent interfaces from resetting, causing VISA to detect stale devices.

After installing the NI Package Manager, it asks what packages you want.

Select both:

  • NI-VISA Configuration Support: view and configure instruments
  • NI-VISA Interactive Control: test VISA communication manually

Uncheck everything and click next. Only the VISA runtime is needed.

The VISA runtime installs regardless of your selection. Reboot after setup.

Screenshot of NI VISA installation packages

Install PyVISA

PyVISA supports Python 3.6+. Install Python from the Microsoft Store or python.org.

python -m venv .venv
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
.venv\Scripts\activate

Install packages

pip install pyvisa

For networked instruments, also install:

pip install psutil zeroconf

Verify installation

import pyvisa

rm = pyvisa.ResourceManager()
print(rm.list_resources())

Expected output (varies by connected instruments):

('ASRL3::INSTR', 'ASRL4::INSTR', 'USB0::VID::PID::SN::INSTR')

Log measurements automatically

Once PyVISA is running, connect it to TofuPilot to log and analyze every test result with pass/fail status and traceability. Free to start.

Corporate and Enterprise Environments

Proxy and Firewall Configuration

# Install PyVISA behind a corporate proxy
pip install --proxy http://proxy.company.com:8080 pyvisa psutil zeroconf

Group Policy and Permissions

# Check current execution policy
Get-ExecutionPolicy

# For corporate environments, use RemoteSigned
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Silent Installation for IT Deployment

@echo off
REM Silent NI-VISA installation
NIPackageManager.exe --accept-license --install-packages "ni-visa"

REM Silent Python + PyVISA installation
pip install --quiet --no-input pyvisa psutil zeroconf

Advanced Configuration

Multiple VISA Runtimes

If you have both NI-VISA and Keysight IO Libraries installed, you can target a specific runtime:

import pyvisa

rm_ni = pyvisa.ResourceManager("C:/Windows/System32/visa32.dll")
rm_ks = pyvisa.ResourceManager("C:/Program Files/Keysight/IO Libraries Suite/bin/visa32.dll")

print(f"NI-VISA found: {rm_ni.list_resources()}")
print(f"Keysight found: {rm_ks.list_resources()}")

Connection Parameters

ParameterDescriptionDefault
chunk_sizeBuffer size for data transfers (bytes)20480
timeoutOperation timeout (ms)2000
write_terminationLine termination for writes\n
read_terminationLine termination for reads\n
import pyvisa

rm = pyvisa.ResourceManager()
inst = rm.open_resource("USB0::0x1234::0x5678::SN::INSTR")

inst.chunk_size = 1024 * 1024  # 1 MB for large transfers
inst.timeout = 30000  # 30 seconds for slow instruments

Virtual Machines and WSL

VMware/VirtualBox: Enable USB passthrough for USB instruments.

WSL: PyVISA doesn't work inside WSL. Use Windows Python instead:

/mnt/c/Python39/python.exe -c "import pyvisa; print(pyvisa.ResourceManager().list_resources())"

Troubleshooting

Device Not Found

  1. Check physical connection (cable, power)
  2. Open Device Manager (devmgmt.msc), look for unknown devices under "Other devices"
  3. Open NI-VISA Interactive Control and try connecting manually
  4. If that fails, the issue is hardware or driver related

Common Errors

Driver Conflicts

If multiple VISA runtimes conflict:

  1. Uninstall manufacturer-specific VISA (Keysight, R&S)
  2. Uninstall old NI-VISA versions
  3. Restart
  4. Install latest NI-VISA clean

Network Instrument Firewall Ports

ProtocolPort
VXI-11TCP 111 + dynamic
HiSLIPTCP 4880
Raw SocketTCP 5025 (typical)

Alternative VISA Backends

PyVISA-py (Pure Python)

No VISA runtime required. Limited USB support (needs libusb).

pip install pyvisa-py
python -c "import pyvisa; rm = pyvisa.ResourceManager('@py'); print(rm.list_resources())"

Keysight IO Libraries Suite

Better performance with Keysight instruments. Free download from the Keysight website.

R&S VISA

Optimized for Rohde & Schwarz instruments. Download from the R&S support portal.