{"record":{"id":"c45562201e13bd3f","repo":"pypa/pip","slug":"you-must-give-at-least-one-requirement-to-name-c45562","errorCode":null,"errorMessage":"You must give at least one requirement to {name} (see \"pip help {name}\")","messagePattern":"You must give at least one requirement to (.+?) \\(see \"pip help (.+?)\"\\)","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/cli/req_command.py","lineNumber":459,"sourceCode":"            options.require_hashes = True\n\n        if not (\n            args\n            or options.editables\n            or options.requirements\n            or options.dependency_groups\n            or options.requirements_from_scripts\n        ):\n            opts = {\"name\": self.name}\n            if options.find_links:\n                raise CommandError(\n                    \"You must give at least one requirement to {name} \"\n                    '(maybe you meant \"pip {name} {links}\"?)'.format(\n                        **dict(opts, links=\" \".join(options.find_links))\n                    )\n                )\n            else:\n                raise CommandError(\n                    \"You must give at least one requirement to {name} \"\n                    '(see \"pip help {name}\")'.format(**opts)\n                )\n\n        return requirements\n\n    @staticmethod\n    def trace_basic_info(finder: PackageFinder) -> None:\n        \"\"\"\n        Trace basic information about the provided objects.\n        \"\"\"\n        # Display where finder is looking for packages\n        search_scope = finder.search_scope\n        locations = search_scope.get_formatted_locations()\n        if locations:\n            logger.info(locations)\n\n    def _build_package_finder(","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/cli/req_command.py#L441-L477","documentation":"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>`.","triggerScenarios":"`pip install` with no arguments; `pip download` with nothing to download.","commonSituations":"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.","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."],"exampleFix":"# before\npip install\n# after\npip install requests","handlingStrategy":"validation","validationCode":"# Ensure at least one requirement source is provided.\ndef has_any_requirement(opts, packages):\n    return bool(packages or opts.get(\"editables\") or opts.get(\"requirements\") or opts.get(\"group\") or opts.get(\"requirements_from_scripts\"))\ndef validate_required(opts, packages):\n    if not has_any_requirement(opts, packages):\n        raise ValueError(\"must give at least one requirement (package name, -r, -e, --group, or script)\")\n    return True","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In wrapper scripts, fail fast if the package-name variable is empty before calling pip."],"tags":["cli-options","requirements","command-error"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}