pypa/pip · error · InstallationError

Error parsing entry points for

Error message

Error parsing entry points for {self.raw_name}: {e}

What it means

Raised as InstallationError from Distribution.iter_entry_points in pkg_resources.py:215-221. When pkg_resources' get_entry_map() raises ValueError parsing entry_points.txt (malformed entry), pip wraps it with the distribution's raw name so the offending package is identifiable — parallel to the importlib backend's handling.

Solutions

  1. Reinstall the package from a version with valid entry_points.txt.
  2. Fix the entry_points definition in the source and rebuild.
  3. Remove the offending entry_points.txt if console scripts are not needed.

Example fix

// before (entry_points.txt)
[console_scripts]
mycmd ;
// after
[console_scripts]
mycmd = mypkg.cli:main
Defensive patterns

Strategy: try-catch

Validate before calling

// Before iterating entry points, validate the entry_points.txt via configparser:
ep = dist._dist.get_metadata('entry_points.txt') if dist._dist.has_metadata('entry_points.txt') else None
if ep:
    cp = configparser.ConfigParser(); cp.read_string(ep)

Try / catch

from pip._internal.exceptions import InstallationError
try:
    list(dist.iter_entry_points())
except InstallationError as e:
    if 'Error parsing entry points' in str(e):
        # reinstall or drop the package's entry_points.txt
        ...

Prevention

When it happens

Trigger: Accessing iter_entry_points() on a pkg_resources-backed Distribution whose entry_points.txt has a syntactically invalid entry; get_entry_map() raises ValueError, re-raised as InstallationError.

Common situations: A package with a hand-edited or buggy entry_points.txt; an old build that emitted malformed entry-point strings; tooling that rewrote entry_points.txt incorrectly.

Related errors


AI-assisted analysis of pypa/pip@f399c37189 (2026-08-08). Data as JSON: /api/errors/28710f2c53d35ca1. Report an issue: GitHub.

Appendix: source

Thrown at src/pip/_internal/metadata/pkg_resources.py:219

        return self._dist.has_metadata(str(path))

    def iter_distutils_script_names(self) -> Iterator[str]:
        yield from self._dist.metadata_listdir("scripts")

    def read_text(self, path: InfoPath) -> str:
        name = str(path)
        if not self._dist.has_metadata(name):
            raise FileNotFoundError(name)
        content = self._dist.get_metadata(name)
        if content is None:
            raise NoneMetadataError(self, name)
        return content

    def iter_entry_points(self) -> Iterable[BaseEntryPoint]:
        try:
            entry_map = self._dist.get_entry_map()
        except ValueError as e:
            raise InstallationError(
                f"Error parsing entry points for {self.raw_name}: {e}"
            ) from e
        for group, entries in entry_map.items():
            for name, entry_point in entries.items():
                name, _, value = str(entry_point).partition("=")
                yield EntryPoint(name=name.strip(), value=value.strip(), group=group)

    def _metadata_impl(self) -> email.message.Message:
        """
        :raises NoneMetadataError: if the distribution reports `has_metadata()`
            True but `get_metadata()` returns None.
        """
        if isinstance(self._dist, pkg_resources.DistInfoDistribution):
            metadata_name = "METADATA"
        else:
            metadata_name = "PKG-INFO"
        try:
            metadata = self.read_text(metadata_name)

View on GitHub (pinned to f399c37189)