4

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.

Ajax
  • 1,418
  • 2
  • 17
  • 38
  • Having same versions of python, pyvisa, NI Visa and apparently Windows, I can't reproduce this problem. Does NI VISA installer requires reboot after installation? Did you reboot? You also can try checking where python tries to look for dlls with a tool like Sysinternals ProcMon. – Roman Nov 24 '18 at 16:39
  • That's a helpful piece of information. I already tried re-boot, no luck. What was your order of install? Python then pyvisa then NI-VISA? – Ajax Nov 24 '18 at 21:32
  • It's hard to say. I was updating NI Visa from previous versions after I initially installed it. – Roman Nov 25 '18 at 13:50
  • very strange. pyvisa appears to ignore the visa_library argument. If possible, can you tell me what NI-VISA entries appear in your path and environmental variables? – Ajax Dec 02 '18 at 15:43
  • I have only these entries in PATH that look related to NI-VISA. "C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;" and "C:\Program Files\IVI Foundation\VISA\Win64\Bin\;". "C:\WINDOWS\system32;" is also present in the PATH. – Roman Dec 10 '18 at 09:55

0 Answers0