{"id":24410,"library":"pytango","title":"PyTango","description":"PyTango provides Python bindings for the cppTango library, part of the Tango Distributed Control System (DCS). Current version is 10.1.4, with main releases following cppTango major versions. It enables Python device servers and clients for Tango controls.","status":"active","version":"10.1.4","language":"python","source_language":"en","source_url":"https://github.com/tango-controls/pytango","tags":["tango","controls","pytango","bindings","cpptango"],"install":[{"cmd":"pip install pytango","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core C++ library, required at build time. Must be installed separately (e.g., conda or system package).","package":"cpptango","optional":false},{"reason":"Required for attribute data handling.","package":"numpy","optional":false},{"reason":"Often used for configuration files.","package":"PyYAML","optional":true}],"imports":[{"note":"","wrong":"","symbol":"DeviceProxy","correct":"from tango import DeviceProxy"},{"note":"","wrong":"","symbol":"Database","correct":"from tango import Database"},{"note":"DeviceClass is in tango.server, not top-level tango.","wrong":"from tango import DeviceClass","symbol":"DeviceClass","correct":"from tango.server import DeviceClass"},{"note":"Decorator is in tango.server.","wrong":"from tango import command","symbol":"command","correct":"from tango.server import command"}],"quickstart":{"code":"import tango\nimport os\n\nproxy = tango.DeviceProxy(\"sys/tg_test/1\")\n# Read a scalar attribute\nprint(\"Attribute value:\", proxy.read_attribute(\"double_scalar\").value)\n\n# Write an attribute\nproxy.write_attribute(\"double_scalar\", 3.14)\n\n# Execute a command\nresult = proxy.command_inout(\"DevString\", \"hello\")\nprint(\"Command result:\", result)\n","lang":"python","description":"Connect to a Tango device, read/write attributes, and execute commands. Assumes a running Tango database and test device."},"warnings":[{"fix":"Upgrade to Python 3.10+ or use PyTango 9.x (but 9.x is deprecated).","message":"PyTango 10.x requires Python >=3.10, dropping support for older Python versions.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Change import to 'from tango.server import DeviceClass'.","message":"In PyTango 10, the 'tango' module no longer imports 'DeviceClass' at top level; it moved to 'tango.server'. Code using 'from tango import DeviceClass' will break.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Use thread-safe queues or locking mechanisms when updating shared state from event callbacks.","message":"Event subscription callbacks are called from a separate thread, causing potential concurrency issues if not handled properly (e.g., updating GUI).","severity":"gotcha","affected_versions":"all"},{"fix":"Install cppTango using conda (conda install -c conda-forge cpptango) or system package before pip install.","message":"Many users try to install pytango via pip without installing cppTango first, leading to compilation errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace uses with standard Python utilities or tango built-ins.","message":"The 'tango.utils' module is deprecated and may be removed in a future version.","severity":"deprecated","affected_versions":">=10.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install pytango' (or 'conda install -c conda-forge pytango'). Ensure virtual environment is activated.","cause":"PyTango is not installed or not in the Python path.","error":"ModuleNotFoundError: No module named 'tango'"},{"fix":"Install cppTango via conda ('conda install -c conda-forge cpptango') or set LD_LIBRARY_PATH to the directory containing libtango.so.","cause":"cppTango shared library is not installed or not in LD_LIBRARY_PATH.","error":"ImportError: libtango.so: cannot open shared object file: No such file or directory"},{"fix":"Change import to 'from tango.server import DeviceClass'.","cause":"Code uses 'from tango import DeviceClass', which moved to tango.server in v10.","error":"AttributeError: module 'tango' has no attribute 'DeviceClass'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}