{"id":24869,"library":"zhinst","title":"Zurich Instruments Python API","description":"Official Python API for Zurich Instruments device control and data acquisition. Current version 26.4.0, requires Python ≥3.10. Major releases every few months with API changes; LabOne software version compatibility is critical.","status":"active","version":"26.4.0","language":"python","source_language":"en","source_url":"https://github.com/zhinst/zhinst","tags":["instrument-control","data-acquisition","zurich-instruments","labone","quantum-computing","measurement"],"install":[{"cmd":"pip install zhinst","lang":"bash","label":"Standard install"},{"cmd":"pip install zhinst[examples]","lang":"bash","label":"With examples"}],"dependencies":[{"reason":"Numerical data handling","package":"numpy","optional":false},{"reason":"Plotting (optional)","package":"matplotlib","optional":true},{"reason":"VISA backend for instrument communication","package":"pyvisa-py","optional":true}],"imports":[{"note":"Session moved to toolkit in v21+","wrong":"from zhinst.core import Session","symbol":"ziSession","correct":"from zhinst.toolkit import Session"},{"note":"Class name is ziDAQServer, not DataServer","wrong":"from zhinst import DataServer","symbol":"DataServer","correct":"from zhinst.core import ziDAQServer"}],"quickstart":{"code":"import os\nfrom zhinst.toolkit import Session\n\nserver_host = os.environ.get('ZI_SERVER_HOST', 'localhost')\nserver_port = int(os.environ.get('ZI_SERVER_PORT', 8004))\napi_level = 6\n\nsession = Session(server_host, server_port, api_level)\ndevice_id = os.environ.get('ZI_DEVICE_ID', 'dev1234')\n\na = session.connect_device(device_id)\nprint('Connected:', a)\n\n# Example: set output amplitude\nawg = a.awgs[0]\nawg.amplitude(0.5)\nprint('Amplitude set to:', awg.amplitude())","lang":"python","description":"Connect to a Zurich Instruments device via Data Server using toolkit Session."},"warnings":[{"fix":"Start the Data Server (ziServer) before running your Python script.","message":"The 'zhinst' package requires the LabOne Data Server to be running; the API does not start it automatically.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'zhinst.core.ziDAQServer' and 'zhinst.toolkit.Session'.","message":"In v23+ the 'zhinst.core' subpackage was reorganized; many classes moved or were renamed (e.g., 'ziDAQServer' instead of 'DataServer').","severity":"breaking","affected_versions":">=23.0.0"},{"fix":"Set api_level=6 for LabOne 23+; check labOne compatibility table.","message":"API level must match the LabOne version; using the wrong API level causes silent errors or connection failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'zhinst.toolkit' or refer to official examples repository.","message":"The 'zhinst.examples' and 'zhinst.ziPython' modules are deprecated since v22.","severity":"deprecated","affected_versions":">=22.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from zhinst.toolkit import Session","cause":"Incorrect import path; Session is in zhinst.toolkit.","error":"ImportError: cannot import name 'Session' from 'zhinst'"},{"fix":"Install latest zhinst: pip install --upgrade zhinst","cause":"Package not installed; older version may have different subpackage structure.","error":"ModuleNotFoundError: No module named 'zhinst.core'"},{"fix":"Start LabOne Data Server and ensure 'localhost:8004' is accessible.","cause":"Data Server (ziServer) not running or wrong host/port.","error":"zhinst.exceptions.ZIError: Data server not responding."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}