{"id":486,"library":"findpython","title":"findpython","description":"findpython is a Python utility library designed to locate various Python versions installed on your system. It is a modern rewrite of the `pythonfinder` project, simplifying the codebase while retaining core functionality. The current version is 0.7.1, and the project maintains an active release cadence with frequent bug fixes and feature enhancements.","status":"active","version":"0.7.1","language":"python","source_language":"en","source_url":"https://github.com/frostming/findpython","tags":["python-discovery","environment-management","interpreter-location","toolchain"],"install":[{"cmd":"pip install findpython","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required to run the library itself.","package":"python","optional":false}],"imports":[{"note":"The primary module to import for accessing utility functions.","symbol":"findpython","correct":"import findpython"},{"note":"The named tuple representing a found Python version, often returned by functions like `find_pythons()`.","symbol":"PythonVersion","correct":"from findpython.python_version import PythonVersion"}],"quickstart":{"code":"import findpython\n\n# Find all Python versions on the system\npythons = findpython.find_pythons()\nfor p in pythons:\n    print(f\"Found Python: {p.executable} (Version: {p.major}.{p.minor}.{p.patch}, 64bit: {p.is_64bit})\")\n\n# Find a specific Python version (e.g., Python 3.9)\npy39 = findpython.find_python(3, 9)\nif py39:\n    print(f\"Found Python 3.9: {py39.executable}\")\nelse:\n    print(\"Python 3.9 not found.\")","lang":"python","description":"This example demonstrates how to find all installed Python versions and how to search for a specific major and minor version using the `findpython` library."},"warnings":[{"fix":"Upgrade Python to 3.8 or newer, or pin `findpython<0.5.0`.","message":"Version 0.5.0 dropped official support for Python 3.7. Users on Python 3.7 should either upgrade their Python environment or pin findpython to a version older than 0.5.0.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Explicitly filter the results from `find_pythons()` based on the `is_64bit` attribute if you require a 32-bit Python, or ensure the desired interpreter is prioritized in your PATH/environment.","message":"As of version 0.6.3, `findpython` prefers 64-bit Python interpreters over 32-bit ones when both are available and meet other criteria. This might alter the expected result if your system has mixed architectures and you rely on a specific 32-bit interpreter.","severity":"gotcha","affected_versions":">=0.6.3"},{"fix":"Review your code if it makes assumptions about Python interpreter types or if you are specifically looking for/excluding free-threaded interpreters. The `PythonVersion` object's properties should be checked for free-threaded status.","message":"Version 0.7.0 introduced a feature to separate free-threaded Python versions from normal ones. While not strictly 'breaking', this change means that the `PythonVersion` objects returned might now include an indication of whether an interpreter is free-threaded, which could affect how you filter or interpret the results if you have such environments.","severity":"gotcha","affected_versions":">=0.7.0"},{"fix":"Inspect the `executable` path of the `PythonVersion` objects returned by `find_pythons()` to confirm it's the desired interpreter. For specific environments, ensure that the preferred Python is correctly configured in your system's PATH or environment variables.","message":"The library searches for Python in various locations including PATH, pyenv, asdf, rye, uv, macOS Frameworks, and Windows registry. The order of preference can be complex, and `findpython` might not always return the exact Python you expect if multiple versions are present and configured differently across these sources.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult the official `findpython` library documentation for the current API to locate Python interpreters, or pin the `findpython` dependency to a version where `find_pythons()` is still available (e.g., `<0.X.Y`).","message":"The `find_pythons()` function, a primary entry point for discovering Python interpreters, has been removed or renamed. This breaking change requires users to update their code to use the new API or pin to an older `findpython` version.","severity":"breaking","affected_versions":"A specific version or range where this API change occurred (e.g., `>=0.X.Y`)"},{"fix":"Replace `findpython.find_pythons()` with `findpython.find_all_pythons()` in your code.","message":"The `find_pythons()` function was renamed to `find_all_pythons()`.","severity":"breaking","affected_versions":">=0.8.0"}],"env_vars":null,"last_verified":"2026-05-12T14:13:40.940Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install the library using pip: `pip install findpython`","cause":"The `findpython` library is not installed in the current Python environment or the Python interpreter cannot locate it in its search path.","error":"ModuleNotFoundError: No module named 'findpython'"},{"fix":"Always check if `findpython.find()` returned a `PythonVersion` object before accessing its attributes. For example:\n```python\nimport findpython\n\npython_version = findpython.find(3, 9)\nif python_version:\n    print(python_version.executable)\nelse:\n    print(\"Python 3.9 not found.\")\n```","cause":"This error occurs when `findpython.find()` is called but fails to locate a Python version matching the criteria, returning `None`. Subsequently, an attempt is made to access an attribute (like 'executable') on this `None` object.","error":"AttributeError: 'NoneType' object has no attribute 'executable'"},{"fix":"The primary functions in the Python `findpython` library are `findpython.find()` and `findpython.find_all()`. Use these functions directly from the imported `findpython` module:\n```python\nimport findpython\n\n# To find a specific Python version\npython_exe = findpython.find(major=3, minor=9)\nprint(python_exe)\n\n# To find all Python versions\nall_pythons = findpython.find_all()\nfor py in all_pythons:\n    print(py.executable)\n```","cause":"This error often arises from confusion with the `findpython` R package or older versions/other libraries (like `pythonfinder`) that might have used a similar function name. The Python `findpython` library does not expose a top-level function named `find_python_cmd`.","error":"ImportError: cannot import name 'find_python_cmd' from 'findpython'"}],"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.11,"mem_mb":3.8,"disk_size":"18.8M"},{"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.07,"mem_mb":3.8,"disk_size":"19M"},{"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":4.5,"disk_size":"20.8M"},{"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.16,"mem_mb":4.5,"disk_size":"21M"},{"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.15,"mem_mb":4.5,"disk_size":"12.7M"},{"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.15,"mem_mb":4.4,"disk_size":"13M"},{"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.15,"mem_mb":4.7,"disk_size":"12.3M"},{"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.14,"mem_mb":4.7,"disk_size":"13M"},{"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.09,"mem_mb":3.3,"disk_size":"18.3M"},{"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.07,"mem_mb":3.3,"disk_size":"19M"}]},"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}]}}