pypa/pip · error · CommandError

You must give at least one requirement to

Error message

You must give at least one requirement to {name} (maybe you meant "pip {name} {links}"?)

What it means

Raised as CommandError in RequirementCommand.get_requirements (req_command.py:452) when no requirement source was provided (no args, no -e, no -r, no --group, no --requirements-from-script per the check at lines 443-449) BUT options.find_links is non-empty. Because find-links are sources, not things to install, pip assumes the user forgot the package name and helpfully suggests `pip <name> <links>` so they can discover and install from that index.

Solutions

  1. Add the package name(s) to install: `pip install --find-links /opt/wheels <pkg>`.
  2. If unsure of available packages, run `pip install --find-links /opt/wheels --dry-run <guess>` or list the directory contents.

Example fix

# before
pip install --find-links /opt/wheels
# after
pip install --find-links /opt/wheels requests
Defensive patterns

Strategy: validation

Validate before calling

# Require at least one install target whenever find-links is set.
def validate_install_targets(opts, packages):
    has_src = bool(packages or opts.get("editables") or opts.get("requirements") or opts.get("group") or opts.get("requirements_from_scripts"))
    if opts.get("find_links") and not has_src:
        raise ValueError("--find-links needs a package name to install")
    return True

Prevention

When it happens

Trigger: `pip install --find-links /opt/wheels` with no package argument; `pip install -f https://my.index/` alone.

Common situations: Setting up a private wheelhouse and forgetting to name the package; expecting find-links to install everything in the directory.

Related errors


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

Appendix: source

Thrown at src/pip/_internal/cli/req_command.py:452

        # If any requirement has hash options, enable hash checking for all
        # requirements, unless this mechanism has been explicitly disabled
        # with --no-require-hashes.
        if not options.no_require_hashes and any(
            req.has_hash_options for req in requirements
        ):
            options.require_hashes = True

        if not (
            args
            or options.editables
            or options.requirements
            or options.dependency_groups
            or options.requirements_from_scripts
        ):
            opts = {"name": self.name}
            if options.find_links:
                raise CommandError(
                    "You must give at least one requirement to {name} "
                    '(maybe you meant "pip {name} {links}"?)'.format(
                        **dict(opts, links=" ".join(options.find_links))
                    )
                )
            else:
                raise CommandError(
                    "You must give at least one requirement to {name} "
                    '(see "pip help {name}")'.format(**opts)
                )

        return requirements

    @staticmethod
    def trace_basic_info(finder: PackageFinder) -> None:
        """
        Trace basic information about the provided objects.
        """

View on GitHub (pinned to f399c37189)