pypa/pip · error · CommandError

You must give at least one requirement to {name} (see "pip h

Error message

You must give at least one requirement to {name} (see "pip help {name}")

What it means

Raised by RequirementCommand when an install/download/wheel call has no requirement of any kind and also no --find-links, so there is nothing helpful to suggest beyond the general help. It is the catch-all counterpart to error 21: pip cannot proceed because the command would install nothing.

Source

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

            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.
        """
        # Display where finder is looking for packages
        search_scope = finder.search_scope
        locations = search_scope.get_formatted_locations()
        if locations:
            logger.info(locations)

    def _build_package_finder(

View on GitHub (pinned to d7d0d0a394)

Solutions

  1. Supply at least one requirement: a package name, -r requirements.txt, -e <path>, or an archive URL.
  2. If the requirement should come from a variable, assert the variable is non-empty before invoking pip.
  3. Run 'pip help install' (or download/wheel) to review accepted input forms.

Example fix

// before
pip install
// after
pip install requests
Defensive patterns

Strategy: validation

Validate before calling

has_req = bool(packages or requirements_files or editables or dependency_groups)
if not has_req:
    raise SystemExit("pip install needs at least one requirement")

Prevention

When it happens

Trigger: Bare 'pip install', 'pip download', or 'pip wheel' with no positional package, no -r file, no -e, no --find-links. The else branch at req_command.py:458 is reached.

Common situations: A CI matrix variable that resolved to empty; a script that builds a requirements list at runtime but produced zero entries; a typo'd -r (e.g. '-R'); running the command expecting an interactive prompt.

Related errors


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