pyvisa no longer able to load Keysight VISA in Python 3.8 on Windows
See original GitHub issuePython 3.8 changes .dll load behavior. See https://github.com/Toblerity/Fiona/issues/851
This used to work:
import pyvisa
rm = pyvisa.ResourceManager('ktvisa32')
… but now it doesn’t. The problem is that Keysight VISA stores a bunch of its .dll’s in a separate directory (not c:\windows\system32, but C:\Program Files (x86)\Keysight\IO Libraries Suite\bin) that is on the PATH. With the change in behavior, the PATH is no longer searched and so the ktvisa32.dll .dll fails to load because its dependant .dll’s can’t be found.
As a workaround, users can use the following syntax:
32-bit Python:
import os
os.add_dll_directory('C:\\Program Files (x86)\\Keysight\\IO Libraries Suite\\bin')
import pyvisa
rm = pyvisa.ResourceManager('ktvisa32')
64-bit Python:
import os
os.add_dll_directory('C:\\Program Files\\Keysight\\IO Libraries Suite\\bin')
import pyvisa
rm = pyvisa.ResourceManager('ktvisa32')
Feel free to reach out to me if you need someone to test a fix, or something (alan_copeland@keysight.com)
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Miscellaneous questions — PyVISA 1.12.1.dev43+g37c774d ...
OSError: Could not open VISA library: function 'viOpen' not found . Starting with Python 3.8, the .dll load behavior has changed on...
Read more >python - pyvisa, function viOpen not found - Stack Overflow
In my specific case, I am interested in loading the keysight visa, so the below works for me. import os os.add_dll_directory('C:\\Program Files ...
Read more >File Transfer from PC to NA with Python - Keysight Community
I have been able to test the code I wrote, using Python 3.8, with the MMEM:TRAN SCPI command. It works with a simple...
Read more >virtual instruments (pyvisa) usb connect - VMware Communities
I'm trying to connect a Keysight power supply and digital multimeter to VMware (via USB) and control them with Python. I'm using pyvisa...
Read more >PyVISA 1.11.3 - PyPI
Python VISA bindings for GPIB, RS232, TCPIP and USB instruments. ... a way to specify paths in which to look for dll on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As per the discussion in this issue, it was decided to simply document the behavior and add the possibility to provide the additional path in the configuration file. No changes (that would have been Keysight and Windows specific) have been made to PyVISA.
If you think the documentation and/or the error message need to be improved feel free to open a PR. Adding additional details to the error message that would be Windows specific sounds perfectly doable for example.
Using pyvisa-1.11.3 (installed using pip) in Python 3.8.7 I still had to use this code
os.add_dll_directory('C:\\Program Files\\Keysight\\IO Libraries Suite\\bin')
to avoid getting the errorVI_ERROR_LIBRARY_NFOUND (-1073807202): A code library required by VISA could not be located or loaded.
I have even tried the pyvisa version 1.10.0.rc with no success.