pypa/pip · error · ImportError

Entry point %r not found

Error message

Entry point %r not found

What it means

Raised as ImportError from Distribution.load_entry_point() when get_entry_info(group, name) returns None — meaning no entry point with that (group, name) pair exists in the distribution's entry_points.txt. It is the canonical 'entry point missing' signal used by code that tries to invoke a console script or plugin hook.

Source

Thrown at src/pip/_vendor/pkg_resources/__init__.py:3180

    ):
        return cls.from_location(
            _normalize_cached(filename), os.path.basename(filename), metadata, **kw
        )

    def as_requirement(self):
        """Return a ``Requirement`` that matches this distribution exactly"""
        if isinstance(self.parsed_version, _packaging_version.Version):
            spec = "%s==%s" % (self.project_name, self.parsed_version)
        else:
            spec = "%s===%s" % (self.project_name, self.parsed_version)

        return Requirement.parse(spec)

    def load_entry_point(self, group: str, name: str) -> _ResolvedEntryPoint:
        """Return the `name` entry point of `group` or raise ImportError"""
        ep = self.get_entry_info(group, name)
        if ep is None:
            raise ImportError("Entry point %r not found" % ((group, name),))
        return ep.load()

    @overload
    def get_entry_map(self, group: None = None) -> dict[str, dict[str, EntryPoint]]: ...
    @overload
    def get_entry_map(self, group: str) -> dict[str, EntryPoint]: ...
    def get_entry_map(self, group: str | None = None):
        """Return the entry point map for `group`, or the full entry map"""
        if not hasattr(self, "_ep_map"):
            self._ep_map = EntryPoint.parse_map(
                self._get_metadata('entry_points.txt'), self
            )
        if group is not None:
            return self._ep_map.get(group, {})
        return self._ep_map

    def get_entry_info(self, group: str, name: str):
        """Return the EntryPoint object for `group`+`name`, or ``None``"""

View on GitHub (pinned to d7d0d0a394)

Solutions

  1. Use get_entry_map(group) / get_entry_info(group, name) first and handle None instead of blindly calling load_entry_point.
  2. Verify the group and name against the installed package's entry_points.txt or 'pip show -f <pkg>'.
  3. Install or pin the version of the package that actually provides that entry point.

Example fix

# before
fn = dist.load_entry_point('console_scripts', 'mytool')  # ImportError

# after
ep = dist.get_entry_info('console_scripts', 'mytool')
if ep is None:
    raise SystemExit('mytool entry point not installed')
fn = ep.load()
Defensive patterns

Strategy: validation

Validate before calling

ep = dist.get_entry_info(group, name)
if ep is None:
    raise SystemExit(f'entry point {group}:{name} not installed')
fn = ep.load()

Type guard

def entry_point_exists(dist, group: str, name: str) -> bool:
    return dist.get_entry_info(group, name) is not None

Try / catch

try:
    fn = dist.load_entry_point(group, name)
except ImportError:
    fn = None  # graceful absence

Prevention

When it happens

Trigger: Calling dist.load_entry_point(group, name) for a group/name combination that the distribution does not declare; get_entry_map(group).get(name) is None.

Common situations: Wrong group or name string, the entry point was renamed/removed in a newer version, or the package providing the entry point is not the one resolved by pkg_resources.

Related errors


AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04). Data as JSON: /data/errors/62602be763cf7bb5.json. Report an issue: GitHub.