pyvisa can not locate a VISA implementation and fails to load NI-VISA back-end:
>>> import visa
>>> import platform
>>> print(platform.architecture())
('64bit', 'WindowsPE')
>>> rm = visa.ResourceManager(visa_library="C:\\Windows\\System32\\visa64.dll")
ValueError: Could not locate a VISA implementation. Install either the NI binary or pyvisa-py.
The system setup:
- Windows 10 Pro v1709 (64-bit)
- python v2.7.15 (64-bit)
- pyvisa v1.9.1
- NI-Visa 17.50
I have verified the .dll files exist:
- C:\Windows\System32\visa32.dll
- C:\Windows\System32\visa64.dll
and the pyvisa.info reads:
C:\Python27>python -m visa info Machine Details: Platform ID:
Windows-10-10.0.16299 Processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntelPython: Implementation: CPython Executable:
C:\Python27\python.exe Version: 2.7.15 Compiler:
MSC v.1500 64 bit (AMD64) Bits: 64bit Build:
Apr 30 2018 16:30:26 (#v2.7.15:ca079a3ea3) Unicode: UCS2PyVISA Version: 1.9.1 Backends: ni: Version: 1.9.1 (bundled with PyVISA) Binary library: Not found
But for some reason pyvisa fails to load the NI-VISA back end. The same happens if the back end remains unspecified:
>>> import visa
>>> rm = visa.ResourceManager()
ValueError: Could not locate a VISA implementation. Install either the NI binary or pyvisa-py.
I can load the .dll separately:
ctypes.windll.LoadLibrary("C:\\Windows\\System32\\visa32.dll")
Which implies visa is not passing the 'visa_library' argument correctly i.e. pyvisa is searching path (and failing) as opposed to using the specified back end.