pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
282 stars 120 forks source link

VisaIOError #128

Closed matthewyccheung closed 6 years ago

matthewyccheung commented 6 years ago

Hello Everyone,

I've installed NI-VISA and NI 488.2 correctly. When I try running the code below, I get couple errors that I can't seem to figure out:

code:

import visa
rm = visa.ResourceManager(r'C:\Windows\System32\visa64.dll')

errors:

2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202
2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202
2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202
2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202
2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202

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

I'm running Python 3.6.2 and PyVISA 1.9.0

Any help would be greatly appreciated.

Thanks in advance!

MatthieuDartiailh commented 6 years ago

What happens if you do not pass explicitely the dll location ? In general it is not necessary to do so.

matthewyccheung commented 6 years ago

There are more errors generated. Putting no arguments loads the 32 bit dll.

MatthieuDartiailh commented 6 years ago

This is weird. I have worked on several windows machine and never seen this issue. Could you post the output of python -m visa info ? Have you installed several visa library (such Keysight or Tektronik) in addition of National instrument ?

matthewyccheung commented 6 years ago

Here is the output after running python -m visa info

Machine Details:
   Platform ID:    Windows-10-10.0.16299-SP0
   Processor:      Intel64 Family 6 Model 61 Stepping 4, GenuineIntel

Python:
   Implementation: CPython
   Executable:     C:\Users\mcmp\Anaconda3\python.exe
   Version:        3.6.2
   Compiler:       MSC v.1900 64 bit (AMD64)
   Bits:           64bit
   Build:          Sep 19 2017 08:03:39 (#default)
   Unicode:        UCS4

PyVISA Version: 1.9.0

Backends:
   ni:
      Version: 1.9.0 (bundled with PyVISA)
      #1: C:\WINDOWS\system32\visa64.dll:
         found by: auto
         bitness: 64
         Could not get more info:
            VI_ERROR_LIBRARY_NFOUND (-1073807202): A code library required by VISA could not be located or loaded.
      #2: C:\WINDOWS\system32\visa32.dll:
         found by: auto
         bitness: 64
         Could not get more info:
            VI_ERROR_LIBRARY_NFOUND (-1073807202): A code library required by VISA could not be located or loaded.

I don't think I have Keysight or Tektronik VISA libraries installed...

MatthieuDartiailh commented 6 years ago

From the error you get when trying to get the debug info on the library, it looks like you may need to re-install VISA (https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P87BSAS and https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/A-code-library-required-by-VISA-could-not-be-located-or-loaded/td-p/225396). You could first try checking what you get in NI-MAX. But as the issue is in VISA itself, it looks unrelated to pyvisa.

MatthieuDartiailh commented 6 years ago

Actually, I remember seeing something similar in one case on Windows 10 when not letting Ni-VISA deactivate the quick start feature of Windows. Uninstalling and re-installing while permitting the installer to deactivate the feature fixed the issue.

MatthieuDartiailh commented 6 years ago

Any news @matthewyccheung ?

daydin commented 6 years ago

Hello, I'm having the same issue. Was there a solution?

MatthieuDartiailh commented 6 years ago

Did you allow NI-VISA to deactivate windows fast start-up when installing ? and did you reboot after completing the installation ?

daydin commented 6 years ago

I did and I did on both counts.

MatthieuDartiailh commented 6 years ago

Does NIMax works ?

daydin commented 6 years ago

Yes. I had the wrong GPIB address. D'oh! Thank you :)

MatthieuDartiailh commented 6 years ago

No problem...

MatthieuDartiailh commented 6 years ago

Closing since this is old and the solution suggested should work (the issue is not pyvisa related but VISA related).

shark136666 commented 2 years ago

Hello Everyone,

I've installed NI-VISA and NI 488.2 correctly. When I try running the code below, I get couple errors that I can't seem to figure out:

code:

import visa
rm = visa.ResourceManager(r'C:\Windows\System32\visa64.dll')

errors:

2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202
2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202
2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202
2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202
2018-03-07 15:10:48,506 - pyvisa - DEBUG - viOpenDefaultRM('<ViObject object at 0x000001FCC21CEB48>',) -> -1073807202

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

I'm running Python 3.6.2 and PyVISA 1.9.0

Any help would be greatly appreciated.

Thanks in advance!

Hello, if you use pyVisa from pip, try set parameters for your ResourceManager rm = visa.ResourceManager('@py')