pypa/pip · error · CommandError
You must give at least one requirement to
Error message
You must give at least one requirement to {name} (see "pip help {name}") What it means
Raised as CommandError in RequirementCommand.get_requirements (req_command.py:459) when no requirement source of any kind was given (same composite check at lines 443-449) and find_links is also empty. This is the plain 'you forgot to name a package' error for an install/download/uninstall/wheel command, directing the user to `pip help <name>`.
Solutions
- Provide at least one requirement (package name, -r file, -e path, --group, VCS URL, or wheel/sdist path).
- If invoking from a script, ensure the variable holding the package name is non-empty before calling pip.
Example fix
# before pip install # after pip install requests
Defensive patterns
Strategy: validation
Validate before calling
# Ensure at least one requirement source is provided.
def has_any_requirement(opts, packages):
return bool(packages or opts.get("editables") or opts.get("requirements") or opts.get("group") or opts.get("requirements_from_scripts"))
def validate_required(opts, packages):
if not has_any_requirement(opts, packages):
raise ValueError("must give at least one requirement (package name, -r, -e, --group, or script)")
return True Prevention
- In wrapper scripts, fail fast if the package-name variable is empty before calling pip.
When it happens
Trigger: `pip install` with no arguments; `pip download` with nothing to download.
Common situations: Running a wrapper script that drops the package argument due to an unset variable; invoking pip interactively expecting a prompt; a CI step where the package env var was empty.
Related errors
- You must give at least one requirement to
- --build-constraint cannot be used with --no-build-isolation.
- Can not use any platform or abi specific options unless…
- Cannot combine '--path' with '--user' or '--local'
- Cannot use '--only-dependencies' in combination with
AI-assisted analysis of pypa/pip@f399c37189 (2026-08-08).
Data as JSON: /api/errors/c45562201e13bd3f.
Report an issue: GitHub.
Appendix: 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 f399c37189)