pypa/pip · error · CommandError

You must give at least one requirement to {name} (maybe you

Error message

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

What it means

Raised by RequirementCommand when an install/download/wheel call supplies no requirement (no positional arg, no -r/--editable/--dependency-groups/--requirements-from-scripts) but DOES supply --find-links. pip assumes the user intended the find-links entries themselves to be the packages and points them at the correct invocation: 'pip <name> <links>'.

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 d7d0d0a394)

Solutions

  1. Add the package name(s) you want from the find-links dir: pip install --find-links ./wheels mypkg
  2. If you meant 'install everything in this folder', there is no such command - enumerate the packages or build a requirements.txt listing them.
  3. For a fully offline install add --no-index so pip does not fall back to PyPI: pip install --no-index --find-links ./wheels mypkg

Example fix

// before
pip install --find-links ./wheels
// after
pip install --no-index --find-links ./wheels mypkg
Defensive patterns

Strategy: validation

Validate before calling

if not packages and not requirements_files:
    if find_links:
        raise SystemExit(
            "No requirement given; to install from a find-links dir you must "
            "also name the package, e.g. pip install --find-links ./wheels <pkg>"
        )
    raise SystemExit("No requirement given")

Prevention

When it happens

Trigger: Running e.g. 'pip install --find-links ./wheels' with no package name after it; using a find-links directory as if it were a requirements source. The branch at req_command.py:451 is taken because options.find_links is truthy while the args/editables/requirements tuple is empty.

Common situations: Offline/airgapped installs where a local wheel directory was prepared but the package name was forgotten; typos like 'pip install --find-links ./dist' instead of 'pip install --no-index --find-links ./dist mypkg'; CI scripts that parameterize package names but emit an empty string.

Related errors


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