{"id":346,"library":"distro","title":"Distro - OS Platform Information API","description":"Distro is a Python library that provides information about the operating system distribution it runs on, such as a reliable machine-readable ID and version information. It serves as a recommended replacement for Python's original platform.linux_distribution function, which was removed in Python 3.8. The current version is 1.9.0, released on October 5, 2023. The library is actively maintained with a stable release cadence, with the latest release being v1.9.0.","status":"active","version":"1.9.0","language":"python","source_language":"en","source_url":"https://github.com/python-distro/distro","tags":["OS","platform","information","API","Linux","BSD","Python 3.6+"],"install":[{"cmd":"pip install distro","lang":"bash","label":"Install Distro"}],"dependencies":[{"reason":"Provides access to underlying platform information; required for functionality.","package":"platform"}],"imports":[{"note":"Ensure correct import path to access the library's functions.","symbol":"distro","correct":"import distro"}],"quickstart":{"code":"import distro\nprint(distro.id())\nprint(distro.version())\nprint(distro.name())","lang":"python","description":"A simple script to print the distribution ID, version, and name using the Distro library."},"warnings":[{"fix":"Use Distro's id(), version(), and name() functions instead.","message":"The platform.linux_distribution function was removed in Python 3.8. Distro serves as its recommended replacement.","severity":"breaking","affected_versions":">=3.8"},{"fix":"Upgrade to Python 3.6 or later.","message":"Python 2.7, 3.4, and 3.5 support was deprecated in Distro v1.6.0.","severity":"deprecated","affected_versions":">=1.6.0"},{"fix":"Use a virtual environment instead (https://pip.pypa.io/warnings/venv). If running pip as root is intentional and its implications are understood, use the --root-user-action option to suppress this warning.","message":"Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead.","severity":"gotcha","affected_versions":">=3.6"}],"env_vars":null,"search_vec":"'1.9.0':56 '2023':61 '3.6':85 '3.8':51 '5':60 'activ':65 'api':5,81 'bsd':83 'cadenc':71 'current':53 'distribut':18,44 'distro':1,6 'function':45 'id':29 'inform':4,13,32,80 'latest':74 'librari':10,63 'linux':82 'machin':27 'machine-read':26 'maintain':66 'octob':59 'oper':16 'origin':42 'os':2,78 'platform':3,79 'platform.linux':43 'provid':12 'python':9,40,50,84 'readabl':28 'recommend':37 'releas':57,70,75 'reliabl':25 'remov':48 'replac':38 'run':20 'serv':34 'stabl':69 'system':17 'v1.9.0':77 'version':31,54","created_at":"2026-03-28T10:51:31.022145+00:00","updated_at":"2026-04-17T14:14:52.577399+00:00","problems":[{"fix":"Install the 'distro' library using pip: `pip install distro`","cause":"The 'distro' library has not been installed in your Python environment or is not accessible within your current Python path.","error":"ModuleNotFoundError: No module named 'distro'"},{"fix":"Install the 'distro' library (`pip install distro`) and replace calls to `platform.linux_distribution()` with `distro.linux_distribution()`, or preferably with `distro.id()`, `distro.name()`, and `distro.version()` for more granular information.","cause":"The `platform.linux_distribution()` function was deprecated in Python 3.5 and removed in Python 3.8, and code or dependencies are still attempting to use it. The `distro` library is its recommended replacement.","error":"AttributeError: module 'platform' has no attribute 'linux_distribution'"},{"fix":"Replace `distro.linux_distribution()` calls with `distro.id()`, `distro.version()`, and `distro.name()` to retrieve specific distribution information.","cause":"The `distro.linux_distribution()` function itself has been deprecated in `distro` version 1.6.0 and later, in favor of more specific accessor functions.","error":"distro.linux_distribution() is deprecated"},{"fix":"Ensure you have a recent version of the `distro` library installed: `pip install --upgrade distro`. If the error persists, double-check the function name for typos.","cause":"This error typically occurs if an older version of the `distro` library is installed that does not yet include the `id()` (or `version()`, `name()`) consolidated accessor functions, or if there is a typo in the function call.","error":"AttributeError: module 'distro' has no attribute 'id'"},{"fix":"Replace `distro.linux_distribution()` with appropriate `distro` API calls such as `distro.id()`, `distro.name()`, or `distro.version()`.","cause":"The `distro` library's API does not include a `linux_distribution` method; it uses distinct methods like `id()` or `name()`.","error":"AttributeError: module 'distro' has no attribute 'linux_distribution'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"1.9.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/python-distro/distro","docs":null,"changelog":null,"pypi":"https://pypi.org/project/distro/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}