{"id":357,"library":"keyring","title":"Keyring: Secure Password Storage","description":"Keyring is a Python library that provides an easy way to access the system's keyring service, allowing applications to store and retrieve passwords securely. The current version is 25.7.0, released on September 20, 2023. Keyring follows a regular release cadence, with updates addressing compatibility, security, and functionality improvements.","status":"active","version":"25.7.0","language":"python","source_language":"en","source_url":"https://github.com/jaraco/keyring","tags":["security","passwords","keyring","python"],"install":[{"cmd":"pip install keyring","lang":"bash","label":"Install Keyring"}],"dependencies":[{"reason":"Required for KWallet backend on Linux systems","package":"dbus-python","optional":true},{"reason":"Required for Secret Service backend on Linux systems","package":"secretstorage","optional":true}],"imports":[{"note":"Standard import statement for the Keyring library","symbol":"keyring","correct":"import keyring"}],"quickstart":{"code":"import keyring\n\n# Set a password\nkeyring.set_password('system', 'username', 'password')\n\n# Retrieve a password\nretrieved_password = keyring.get_password('system', 'username')\nprint(retrieved_password)","lang":"python","description":"A simple example demonstrating how to set and retrieve passwords using the Keyring library."},"warnings":[{"fix":"Ensure that dbus is correctly installed and configured on your system to avoid these warnings.","message":"On macOS, importing keyring may produce dbus-related warnings if dbus is not properly configured.","severity":"gotcha","affected_versions":"all"},{"fix":"Install a recommended 3rd party backend package such as `keyrings.alt` to enable Keyring functionality. If issues persist after a Python upgrade, ensure all Keyring backend dependencies are compatible and up-to-date.","message":"Keyring requires an external backend package (e.g., `keyrings.alt`, `keyrings.gnome`) to store credentials. If no compatible backend is installed or detected, it will raise a `NoKeyringError`. This can occur in fresh environments or if backend dependencies become incompatible (e.g., after a Python version upgrade).","severity":"breaking","affected_versions":"all"},{"fix":"Install a recommended backend package, such as 'keyrings.alt' for cross-platform compatibility, or 'SecretStorage' on Linux with Secret Service. For example: `pip install keyrings.alt`.","message":"Keyring raises NoKeyringError when no suitable backend is installed or found, preventing the storage and retrieval of passwords.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-12T13:16:01.062Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install a recommended backend for your OS (e.g., 'keyrings.alt' for a fallback, or OS-specific packages like 'gnome-keyring' or 'KWallet' on Linux) and ensure the keyring service is running and accessible.","cause":"The keyring library could not find or access a suitable system keyring backend on the operating system, often occurring in headless environments, Docker containers, or when necessary system components are not installed or running.","error":"RuntimeError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details."},{"fix":"Install a recommended 3rd party backend package such as 'keyrings.alt' (pip install keyrings.alt) or ensure your operating system's native keyring service (like Gnome Keyring on Linux, Keychain on macOS, or Credential Locker on Windows) is installed, configured, and running.","cause":"The keyring library failed to locate an appropriate backend to store or retrieve secrets, which is a specific instance of the 'RuntimeError' when no backend is found.","error":"keyring.errors.NoKeyringError: No recommended backend was available."},{"fix":"Install the keyring package using pip: 'pip install keyring'.","cause":"The 'keyring' Python package is not installed in the current Python environment or is not accessible via the Python interpreter being used.","error":"ModuleNotFoundError: No module named 'keyring'"},{"fix":"Verify that the necessary OS-specific keyring components are installed and configured correctly, or try explicitly setting a different backend if available. For CLI tools, specifying '--keyring-type=none' can temporarily bypass keyring storage.","cause":"A keyring backend that was explicitly requested or expected by keyring or a dependent application could not be initialized or accessed, potentially due to misconfiguration, permissions, or missing system components.","error":"Error opening keyring: Specified keyring backend not available"},{"fix":"Update the wrapping application or library to a version compatible with your installed 'keyring' version, or check the 'keyring' documentation for current API usage if you are directly interacting with keyring backend objects.","cause":"This typically occurs when a wrapping library (like an older version of Poetry) attempts to access an attribute ('name') on a keyring object that no longer exists or has a different name due to an API change in the 'keyring' library.","error":"AttributeError: 'Keyring' object has no attribute 'name'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.18,"mem_mb":7,"disk_size":"35.6M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":7,"disk_size":"36M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.28,"mem_mb":8,"disk_size":"38.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.23,"mem_mb":8,"disk_size":"38M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.23,"mem_mb":8,"disk_size":"29.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.23,"mem_mb":8,"disk_size":"29M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.21,"mem_mb":8.3,"disk_size":"28.6M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.21,"mem_mb":8.3,"disk_size":"29M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":6.7,"disk_size":"35.8M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":6.7,"disk_size":"36M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}