FindLibs is a Python package designed to search for shared libraries across various platforms. It offers a robust search algorithm that includes checking Python module packages, system prefixes, environment variables, user-defined configuration files, and standard system paths. The current version is 0.1.2. It appears to be actively maintained by ECMWF, with regular updates and engagement on GitHub issues.
pip install findlibsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `find` function and use it to locate a shared library by its base name. The function returns the full path to the library if found, otherwise `None`. You can optionally provide `pkg_name` if the library is associated with a specific Python package name different from the library's base name.
Ensure your Python environment is version 3.10 or higher. If you must use an older Python, you may need to pin `findlibs` to an earlier version if one exists that supports it (though none are explicitly stated to do so in the search results) or consider using an alternative library. Update your `pyproject.toml` or `requirements.txt` to specify `python_version >= '3.10'` for `findlibs`.
Be aware that library detection, especially as a last resort, might fail or be incorrect. If `findlibs` cannot locate a library, manually provide the path through environment variables (e.g., `LD_LIBRARY_PATH`, `DYLD_LIBRARY_PATH`, `PKG_NAME_HOME`/`_DIR`) or a `~/.findlibs` configuration file, as these take precedence in `findlibs`'s search algorithm.
If `findlibs` fails to locate a library on Linux, verify the library's actual location and exact filename. Utilize `findlibs`'s configurable search paths, such as setting `PKG_NAME_HOME` or `PKG_NAME_DIR` environment variables (e.g., `ECCODES_HOME`), or defining paths in `~/.findlibs` or `~/.config/findlibs/findlibs.conf`, to explicitly guide `findlibs` to the library's directory.
Ensure your Python environment is version 3.10 or higher. You may need to upgrade Python or switch to a compatible virtual environment. If using `requirements.txt` or `pyproject.toml`, specify `python_version >= '3.10'` for findlibs.
Install the package using `pip install findlibs`. If working within a virtual environment, ensure it is activated before installing and running your code.
Verify that the required shared library (e.g., `libeccodes.so` or `eccodes.dll`) is installed and note its exact path. Explicitly guide `findlibs` by setting relevant environment variables (e.g., `ECCODES_HOME`, `LD_LIBRARY_PATH`, `DYLD_LIBRARY_PATH`) or by configuring `~/.findlibs`. Alternatively, handle the `None` return from `findlibs.find()` in your code to provide a more specific error or fallback.