distlib: Distribution Utilities

raw JSON →
0.4.0 verified Tue May 12 auth: no python install: stale quickstart: stale

distlib is a Python library that provides low-level functions for packaging and distributing Python software, serving as a foundation for third-party packaging tools. The current version is 0.4.0, released on July 17, 2025. The project is actively maintained with regular updates.

pip install distlib
error ModuleNotFoundError: No module named 'distlib'
cause The 'distlib' library is not installed in the Python environment currently in use, or the environment's paths are not correctly configured. This error often appears when 'distlib' is an indirect dependency of other tools like 'pip' or 'virtualenv'.
fix
Ensure 'distlib' is installed by running: pip install distlib
error ImportError: cannot import name 'enquote_executable' from 'distlib.scripts'
cause This error typically occurs due to a version mismatch or a corrupted installation of the 'distlib' library, especially when a tool like 'virtualenv' or 'pip' attempts to import a specific utility that has changed or is missing in the installed 'distlib' version.
fix
Reinstall 'distlib' along with the potentially conflicting tool (e.g., 'virtualenv' or 'pip') to resolve version inconsistencies: pip uninstall distlib virtualenv then pip install virtualenv
error AttributeError: _DistInfoDistribution__dep_map
cause This 'AttributeError' often indicates an incompatibility between different versions of 'pip' and 'setuptools', or an issue with the version of 'distlib' bundled within 'pip'. It can also be related to an outdated `testpath` library.
fix
Upgrade 'pip' and 'setuptools' to their latest versions: pip install --upgrade pip setuptools. If the issue persists, consider reinstalling pip: python -m pip uninstall pip followed by python -m ensurepip and then python -m pip install --upgrade pip
breaking distlib 0.4.0 introduces changes to the Database and Index classes that may require updates to existing codebases.
fix Review the distlib 0.4.0 release notes and update your code to align with the new class implementations.
gotcha Ensure that all import statements reference the correct module paths to avoid ImportError due to module restructuring in distlib 0.4.0.
fix Update import statements to match the new module structure as per the distlib 0.4.0 documentation.
python os / libc status wheel install import disk
3.10 alpine (musl) - - - -
3.10 slim (glibc) - - - -
3.11 alpine (musl) - - - -
3.11 slim (glibc) - - - -
3.12 alpine (musl) - - - -
3.12 slim (glibc) - - - -
3.13 alpine (musl) - - - -
3.13 slim (glibc) - - - -
3.9 alpine (musl) - - - -
3.9 slim (glibc) - - - -

A basic example demonstrating the initialization and usage of distlib's Database and Index classes.

from distlib.database import Database
from distlib.index import Index

# Initialize the database
db = Database()

# Initialize the index
index = Index()

# Example usage of the database and index
# (Replace with actual functionality as needed)
print(db)
print(index)