pyvisa can not locate a VISA implementation

8.1k views Asked by At

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, GenuineIntel

Python: 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: UCS2

PyVISA 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.

1

There are 1 answers

0
user3496191 On

I eventually fixed this issue (for me) by changing from

rm=pyvisa.ResourceManager('C:\WINDOWS\system32\visa32.dll')

to

rm=pyvisa.ResourceManager('C:/WINDOWS/system32/visa32.dll')

Before that, it was working on my dev laptop, without the path specifier, but not working on any desktops in production floor.

An odd symptom was that the first line above also wouldn't work on the dev laptop either, even though that was the same path that pyvisa decided to use when you let it decide(by leaving parentheses empty), which worked on the dev machine.

I know this is 5 years late, but it might help somebody else out who also ends up here at this question. (possibly a future version of myself)