GPIB on macOS 15 (ARM M2) - Page 1
Forum section: electronics / testgear

author: hp3310a
author_rank: Regular Contributor
timestamp: April 29, 2025, 12:36:36 pm
content: I'm on a Mac Studio (ARM M2 chip) and I can't get pyvisa to recognize my the GPIB-USB-HS interface from NI (nor my GPIB-connected devices). NI MAX lists the GPIB-USB-HS adapter but that's about it (screenshot below). This is what I did so far:Install the NI-VISA driversInstall pyvisaInstall pyusbThe problem doesn't appear to be GPIB related because it doesn't even get that far. When I run the minimal Python scriptCode:>>> import pyvisa>>> rm = pyvisa.ResourceManager()>>> rm.list_resources()This is all I get:Code:('ASRL1::INSTR', 'ASRL2::INSTR')So no "USB0::0x3923::0x709B::021703FC::RAW" as listed by NI MAX or the GPIB-connected 53181a (which also doesn't appear in the NI MAX hardware configuration).Can someone who did this already please let me know what I'm missing?

author: baldengineer
author_rank: Contributor
timestamp: April 29, 2025, 02:34:20 pm
content: You might want to look at this thread on the NI forums.https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/GPIB-USB-HS-no-longer-supported-on-recent-macOS-13/td-p/4313190My quick read suggests that PyVISA doesn't support GPIB on macOS.

author: jjoonathan
author_rank: Frequent Contributor
timestamp: April 29, 2025, 03:31:27 pm
content: This is why GPIB-Ethernet adapters are so much better: TCP/IP is supported by every library and every language on every OS since forever and until forever without drivers. Approximately speaking. I used to recommend AD007 but they are rare now. Does anyone have a different GPIB-Ethernet adapter that Just Works with pyvisa-py?Speaking of pyvisa-py, the mac/usb support drop was in NI-VISA not pyvisa-py, so have you checked pyvisa-py? The example on the front page shows how to use it for USB:https://pyvisa.readthedocs.io/projects/pyvisa-py/en/latest/EDIT: and if pyvisa-py USB support is broken on mac os, remember that you have the option of running it on linux. Remote options -- vscode through ssh, jupyterlab through the browser -- are good these days. I run my main jupyterlab instance on my NAS but a raspberry pi or something would do fine. In addition to protecting you from the ongoing MacOS and Windows efforts to kill legacy code in the name of security and USB-A in the name of compactness, this decouples your long-running test scripts from closing the lid on your laptop and untethers your laptop from any UART (or GPIB!) USB dongles. "jupyterlab running on a box in the lab, accessed remotely" is the true next gen experience. Can't recommend it enough.

author: coromonadalix
author_rank: Super Contributor
timestamp: April 29, 2025, 03:52:53 pm
content: that's why the other gpib project here can or could be usefulhttps://www.eevblog.com/forum/projects/poe-ethernet-gpib-adapter-open-source-project-now-public/msg5762141/#msg5762141

author: MiroS
author_rank: Regular Contributor
timestamp: April 29, 2025, 04:55:03 pm
content: Have you tried with environment variable?In my case it is PYVISA_LIBRARY=/Library/Frameworks/VISA.framework/VISA

author: hp3310a
author_rank: Regular Contributor
timestamp: April 29, 2025, 07:41:40 pm
content: Thanks for the replies guys, even though this is not exactly what I was hoping for.Quote from: baldengineer on April 29, 2025, 02:34:20 pmYes, I saw this too, but you know, I was hoping there's a way around it.Quote from: jjoonathan on April 29, 2025, 03:31:27 pmSo, are you saying that if I get a GPIB-ENET/100 (or 1000) this will work with pyvisa without issue (on a modern OS, Arm based Mac)? Is there an alternative/better/cheaper ethernet based solution?Quote from: jjoonathan on April 29, 2025, 03:31:27 pmTried that, didn't change anything.Quote from: MiroS on April 29, 2025, 04:55:03 pmI did, didn't change anything.So, ethernet-based works with an M1/M2/M3 Mac too? I don't want to buy an expensive network "adapter" to find out it works equally badly.

author: Someone
author_rank: Super Contributor
timestamp: April 29, 2025, 11:49:45 pm
content: Quote from: jjoonathan on April 29, 2025, 03:31:27 pmQuote from: hp3310a on April 29, 2025, 07:41:40 pmThere is the prologix GPIB-ETHERNET, which has set the anchor price for the legacy interfaces. Compatbility on the Ethernet side is excellent/trivial but GPIB is a bit fiddly. Hopefully the open source project linked above can grow.Quote from: hp3310a on April 29, 2025, 07:41:40 pmThere is no clean way to connectalllegacy equipment to modern operating systems. If you can find some examples online of others using a specific bridge to your specific instrument then stick with that.

author: jjoonathan
author_rank: Frequent Contributor
timestamp: April 30, 2025, 12:51:15 am
content: Yep, works great on my ARM mac too. I usually run pyvisa on my linux NAS, but I gave it a spin on the native python and it works great:Code:jon~ % uv run --with pyvisa,pyvisa-py python - <<EOFimport pyvisarm = pyvisa.ResourceManager('@py')sg = rm.open_resource('TCPIP::192.168.68.63::gpib0,19::INSTR')print(sg.query('*IDN?'))EOFHEWLETT-PACKARD,83651A,3145A00000,05 APR 94jon~ %Just look at all those drivers I didn't install!

author: hp3310a
author_rank: Regular Contributor
timestamp: April 30, 2025, 10:33:38 am
content: Quote from: jjoonathan on April 30, 2025, 12:51:15 amYes, that would be really great.

author: hp3310a
author_rank: Regular Contributor
timestamp: May 22, 2025, 04:48:49 pm
content: Quote from: jjoonathan on April 30, 2025, 12:51:15 amSo I got a used GPIB ENET/100, got it set up in my LAN and connected it to different Agilent instruments (34401A, 53181A, 33120A) but somehow I fail to get this to work (on my ARM M2 Mac Studio). When I execute the following (interactive Python interpreter mode):Code:import pyvisarm = pyvisa.ResourceManager('@py')sg = rm.open_resource('TCPIP::10.0.0.135::gpib0,3::INSTR')It crashes with the following trace:Code:Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/usr/local/lib/python3.9/site-packages/pyvisa/highlevel.py", line 3292, in open_resourceres.open(access_mode, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa/resources/resource.py", line 281, in openself.session, status = self._resource_manager.open_bare_resource(File "/usr/local/lib/python3.9/site-packages/pyvisa/highlevel.py", line 3217, in open_bare_resourcereturn self.visalib.open(self.session, resource_name, access_mode, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/highlevel.py", line 168, in opensess = cls(session, resource_name, parsed, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/tcpip.py", line 86, in __new__return newcls(resource_manager_session, resource_name, parsed, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/sessions.py", line 322, in __init__self.after_parsing()File "/usr/local/lib/python3.9/site-packages/pyvisa_py/tcpip.py", line 457, in after_parsingself.interface = Vxi11CoreClient(host_address, port, self.open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/tcpip.py", line 361, in __init__rpc.TCPClient.__init__(self, host, prog, vers, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 824, in __init__port = pmap.get_port((prog, vers, IPPROTO_TCP, 0))File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 768, in get_portreturn self.make_call(File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 480, in make_callreturn super(RawTCPClient, self).make_call(proc, args, pack_func, unpack_func)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 235, in make_callself.do_call()File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 497, in do_call_sendrecord(self.sock, call, timeout=self.timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 317, in _sendrecordsock.sendall(header + record[:fragsize])BrokenPipeError: [Errno 32] Broken pipeWhen I execute the last line, I can see the TX/RX LEDs blink on the GPIB-ENET/100, so the device is getting contacted. Seems it doesn't respond correctly, though. I did a reset to factory default settings on the device.Is there a way to know that the GPIB communication from GPIB-ENET/100 to the instruments is working? TALK and LISTEN never ever lights up on the GPIB-ENET/100. Should they light up? Is there a way to test the connection? I tried 3 different instruments and none worked. I don't think the GPIB ports of all of them could be dead, that would be too much bad luck even for me.pyvisa-info gives me a warning but I'm not sure what to do with that either or whether it's relevant for TCPIP.Code:pyvisa-info/usr/local/lib/python3.9/site-packages/gpib_ctypes/gpib/gpib.py:54: UserWarning: GPIB library not found. Please manually load it using _load_lib(filename). All GPIB functions will raise OSError until the library is manually loaded.warnings.warn(message)Machine Details:Platform ID: macOS-15.4-x86_64-i386-64bitProcessor: i386Python:Implementation: CPythonExecutable: /usr/local/opt/python@3.9/bin/python3.9Version: 3.9.6Compiler: Clang 12.0.5 (clang-1205.0.22.9)Architecture: ('x86', 64)Build: Jun 29 2021 05:25:02 (#default)Unicode: UCS4PyVISA Version: 1.14.1Backends:ivi:Version: 1.14.1 (bundled with PyVISA)#1: /Library/Frameworks/visa.framework/visa:found by: autoarchitecture:Vendor: National InstrumentsImpl. Version: 24118528Spec. Version: 7340032py:Version: 0.7.2ASRL INSTR: Available via PySerial (3.5)USB INSTR: Available via PyUSB (1.3.1). Backend: libusb1USB RAW: Available via PyUSB (1.3.1). Backend: libusb1TCPIP INSTR: AvailableResource discovery:- VXI-11: ok- hislip: okTCPIP SOCKET: AvailableVICP INSTR:Please install PyVICP to use this resource type.GPIB INSTR:gpib_ctypes is installed but could not locate the gpib library.Please manually load it using:gpib_ctypes.gpib.gpib._load_lib(filename)before importing pyvisa.GPIB INTFC:gpib_ctypes is installed but could not locate the gpib library.Please manually load it using:gpib_ctypes.gpib.gpib._load_lib(filename)before importing pyvisa.Any input would be greatly appreciated, I have no idea what the problem is.

author: hp3310a
author_rank: Regular Contributor
timestamp: May 22, 2025, 05:23:07 pm
content: OK, so I removed gpib-ctypes which gets rid of the pyvisa-info warning. That changes things, pyvisa-info now reports:Code:Machine Details:Platform ID: macOS-15.4-x86_64-i386-64bitProcessor: i386Python:Implementation: CPythonExecutable: /usr/local/opt/python@3.9/bin/python3.9Version: 3.9.6Compiler: Clang 12.0.5 (clang-1205.0.22.9)Architecture: ('x86', 64)Build: Jun 29 2021 05:25:02 (#default)Unicode: UCS4PyVISA Version: 1.14.1Backends:ivi:Version: 1.14.1 (bundled with PyVISA)#1: /Library/Frameworks/visa.framework/visa:found by: autoarchitecture:Vendor: National InstrumentsImpl. Version: 24118528Spec. Version: 7340032py:Version: 0.7.2ASRL INSTR: Available via PySerial (3.5)USB INSTR: Available via PyUSB (1.3.1). Backend: libusb1USB RAW: Available via PyUSB (1.3.1). Backend: libusb1TCPIP INSTR: AvailableResource discovery:- VXI-11: ok- hislip: okTCPIP SOCKET: AvailableVICP INSTR:Please install PyVICP to use this resource type.GPIB INSTR:Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.No module named 'gpib'GPIB INTFC:Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of functionalities.No module named 'gpib'When executingCode:sg = rm.open_resource('TCPIP0::10.0.0.135::gpib0,3::INSTR')it produces no success, but it's definitely getting "better":Code:Traceback (most recent call last):File "/usr/local/lib/python3.9/site-packages/pyvisa_py/tcpip.py", line 457, in after_parsingself.interface = Vxi11CoreClient(host_address, port, self.open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/tcpip.py", line 361, in __init__rpc.TCPClient.__init__(self, host, prog, vers, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 823, in __init__pmap = TCPPortMapperClient(host, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 803, in __init__RawTCPClient.__init__(self, host, PMAP_PROG, PMAP_VERS, PMAP_PORT, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 454, in __init__self.connect(1e-3 * open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/protocols/rpc.py", line 488, in connectraise RPCError("can't connect to server")pyvisa_py.protocols.rpc.RPCError: can't connect to serverDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/usr/local/lib/python3.9/site-packages/pyvisa/highlevel.py", line 3292, in open_resourceres.open(access_mode, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa/resources/resource.py", line 281, in openself.session, status = self._resource_manager.open_bare_resource(File "/usr/local/lib/python3.9/site-packages/pyvisa/highlevel.py", line 3217, in open_bare_resourcereturn self.visalib.open(self.session, resource_name, access_mode, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/highlevel.py", line 168, in opensess = cls(session, resource_name, parsed, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/tcpip.py", line 86, in __new__return newcls(resource_manager_session, resource_name, parsed, open_timeout)File "/usr/local/lib/python3.9/site-packages/pyvisa_py/sessions.py", line 322, in __init__self.after_parsing()File "/usr/local/lib/python3.9/site-packages/pyvisa_py/tcpip.py", line 459, in after_parsingraise errors.VisaIOError(constants.VI_ERROR_RSRC_NFOUND)pyvisa.errors.VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.I also triedCode:print(rm.list_resources(query='TCP?*'))but it returns an empty list ("()"). The device RX LED lights up twice when the above is executed (guess it received a network broadcast), but apparently it doesn't respond (no TX). Do I have a broken GPIB ENET/100 on my hands?

author: rcjoy
author_rank: Regular Contributor
timestamp: May 22, 2025, 07:28:49 pm
content: On a Mac it's easiest to use an Ethernet-GPIB interface that supports VXI-11.The Agilent E5810A / Keysight E5810B GPIB/LAN interface uses VXI-11, I've used it successfully on a Mac with pyvsia / pyvisa-py.I don't think the NI GPIB-ENET/100 supports VXI-11; it uses it's own proprietary protocol.

author: hp3310a
author_rank: Regular Contributor
timestamp: May 23, 2025, 04:59:39 am
content: I must have thoroughly misunderstood what @jjoonathan said earlier, then. I'm not ready to declare defeat just yet, though I'm not one step closer either.

author: rcjoy
author_rank: Regular Contributor
timestamp: May 23, 2025, 07:08:33 pm
content: An alternative to the Agilent/Keysight E5810 is the ICS 9065. I have not used this model, but it does support VXI-11.https://www.icselect.com/vxi-11_gateway.htmlICS also has a nice overview of VXI-11 and how it works. pyvisa/pyvisa-py implements what is described there.https://www.icselect.com/pdfs/ab80_11.pdfIf you are a C++ programmer and would rather use C++ instead of Python, I created a C++ VXI-11 library, available athttps://github.com/Lew-Engineering/libvxi11I use that C++ library to talk to all of my GPIB instruments on my Macs and Raspberry Pi.

author: voltsandjolts
author_rank: Unknown
timestamp: May 23, 2025, 07:21:14 pm
content: As mentioned in reply #3 there is this open source ethernet-gpib with PoE:https://www.eevblog.com/forum/projects/poe-ethernet-gpib-adapter-open-source-project-now-public/There aretwo firmwares available, one imitates the prologix interface and the other implements VXI-11.The current VXI-11 release works nicely with pyvisa but reponses are limited to 256 bytes (IIRC), however a fix to allow larger reads isimminent.

author: hp3310a
author_rank: Regular Contributor
timestamp: May 23, 2025, 07:37:34 pm
content: Quote from: rcjoy on May 23, 2025, 07:08:33 pmThanks but this is all way way way too expensive. I can't believe I again sunk even more money on tech that is "outdated". My instruments are all from mid 2005, the ENET/100 is from 2007, it has a LAN interface which works perfectly fine, so there's no technological reason. It could just work Windows, Linux, macOS. I'm really surprised that no one has got this to work, am I the only idiot who wishes to use this combination of hardware? Looks like a dead end to me.Quote from: voltsandjolts on May 23, 2025, 07:21:14 pmYes, I realized too late that this might be an option, I was too quick to pull the trigger on the ENET/100. Plus I was hoping that an industry standard device would "just work".