Search code examples
pythonvisa

Error using PyVISA


I've just installed PyVISA using pip

import visa
rs = visa.ResourceManager()

I get this error

Traceback (most recent call last):

File "", line 1, in

File "C:\Anaconda3\lib\site-packages\pyvisa\highlevel.py", line 1486, in new

obj.session, err = visa_library.open_default_resource_manager()

File "C:\Anaconda3\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1212, in open_default_resource_manager

ret = library.viOpenDefaultRM(byref(session))

File "C:\Anaconda3\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 180, in _return_handler

raise errors.VisaIOError(ret_value)

pyvisa.errors.VisaIOError: VI_ERROR_LIBRARY_NFOUND (-1073807202): A code library required by VISA could not be located or loaded.

there's a similar question posted here, based on there suggestion I've tried the following on command prompt: python -c "from pyvisa import util; util.get_debug_info()" & I get this responce,

enter image description here

from the above picture, it's very clear that the error message is the same on both the cases, I have also checked Visa Version from NI MAX: Visa 4.3

enter image description here

am I missing something, Could anybody help?


Solution

  • Finally, I was able to fix the issue just by upgrading NI VISA version from 4.3 to 5.4.1.

    • UnInstall Old NI-VISA Version from Control Panel (National Instruments Software --> Products --> NI-VISA 4.3 & Remove)
    • Install NI-VISA 5.4.1 from here and reboot your pc

    not sure why Visa 4.3 produces the issue, but anyways VISA Ver. 5.4.1 is the solution in my case.