I’m very new to using pyvisa and I’m planning to try to automate some of my lab equipment using it.
However, at the very first hurdle pyvisa is unable to locate any usb devices. I’ve got the NI-VISA installed, and on the NI-VISA wizard the wanted devices are recognised. But when running the following code:
import pyvisa
rm = pyvisa.ResourceManager()
rm.list_resources()
It returns ().
Looking at pyvisa-info:
Python:
Implementation: CPython
Executable: C:UsersAppDataLocalProgramsPythonPython312python.exe
Version: 3.12.3
Compiler: MSC v.1938 64 bit (AMD64)
Architecture: AMD64
Build: Apr 9 2024 14:05:25 (#tags/v3.12.3:f6650f9)
Unicode: UCS4
PyVISA Version: 1.14.1
Backends:
ivi:
Version: 1.14.1 (bundled with PyVISA)
#1: C:WindowsSystem32visa64.dll:
found by: auto
architecture:
('x86', 64)
Vendor: National Instruments
Impl. Version: 25165824
Spec. Version: 7340544
#2: C:WINDOWSsystem32visa32.dll:
found by: auto
architecture:
('x86', 64)
Vendor: National Instruments
Impl. Version: 25165824
Spec. Version: 7340544
#3: C:WINDOWSsystem32visa64.dll:
found by: auto
architecture:
('x86', 64)
Vendor: National Instruments
Impl. Version: 25165824
Spec. Version: 7340544
py:
Version: 0.7.2
ASRL INSTR: Available via PySerial (3.5)
TCPIP INSTR: Available
Resource discovery:
- VXI-11: ok
- hislip: ok
TCPIP SOCKET: Available
USB INSTR:
PyUSB does not seem to be properly installed.
Please refer to PyUSB documentation and
install a suitable backend like
libusb 0.1, libusb 1.0, libusbx,
libusb-win32 or OpenUSB.
No backend available
USB RAW:
PyUSB does not seem to be properly installed.
Please refer to PyUSB documentation and
install a suitable backend like
libusb 0.1, libusb 1.0, libusbx,
libusb-win32 or OpenUSB.
No backend available
VICP INSTR:
Please install PyVICP to use this resource type.
GPIB INSTR:
Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.
No module named 'gpib'
GPIB INTFC:
Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.
No module named 'gpib'
I’ve come up with some possible issues:
- Bitness: trying to use 64bit python alongside the visa64. The NI-VISA came with both visa64 and visa32, I’ve added a .pyvisarc file in the user to create a specific path to visa64. Hence why there is 3 options for the ivi backend. This does not work with a .pyvisarc file and without it. Additionally in my code I’ve tried to specify the visa64 file in the ResourceManager line, no luck either.
- The other issue is that it could be the pyvisa-py backend causing some issues, thought its odd as I’m not using it. The pyUSB appears to not be properly installed, I’ve tried to pip install the recommended backends however no luck either.
I’ve spent way to much time looking at this, so any help is very much appreciated.
-Many thanks!
I’m expecting it to recognise the usb input that connects to a Thorlabs power metre. It however is not, but again the NI-VISA wizard recognises it so very odd.
andy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.