{"record":{"id":"ad590039ed754080","repo":"pypa/pip","slug":"you-must-give-at-least-one-requirement-to-self-na","errorCode":null,"errorMessage":"You must give at least one requirement to {self.name} (see \"pip help {self.name}\")","messagePattern":"You must give at least one requirement to (.+?) \\(see \"pip help (.+?)\"\\)","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/commands/uninstall.py","lineNumber":92,"sourceCode":"                reqs_to_uninstall[canonicalize_name(req.name)] = req\n            else:\n                logger.warning(\n                    \"Invalid requirement: %r ignored -\"\n                    \" the uninstall command expects named\"\n                    \" requirements.\",\n                    name,\n                )\n        for filename in options.requirements:\n            for parsed_req in parse_requirements(\n                filename, options=options, session=session\n            ):\n                req = install_req_from_parsed_requirement(\n                    parsed_req, isolated=options.isolated_mode\n                )\n                if req.name:\n                    reqs_to_uninstall[canonicalize_name(req.name)] = req\n        if not reqs_to_uninstall:\n            raise InstallationError(\n                f\"You must give at least one requirement to {self.name} (see \"\n                f'\"pip help {self.name}\")'\n            )\n\n        if not options.override_externally_managed:\n            check_externally_managed()\n\n        protect_pip_from_modification_on_windows(\n            modifying_pip=\"pip\" in reqs_to_uninstall\n        )\n\n        for req in reqs_to_uninstall.values():\n            uninstall_pathset = req.uninstall(\n                auto_confirm=options.yes,\n                verbose=self.verbosity > 0,\n            )\n            if uninstall_pathset:\n                uninstall_pathset.commit()","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/commands/uninstall.py#L74-L110","documentation":"Raised by the uninstall command after all positional arguments and -r requirement files have been parsed, if reqs_to_uninstall is empty. This means pip was asked to uninstall nothing — either no args were given, every arg failed to parse into a named requirement, or all requirement files were empty.","triggerScenarios":"Running `pip uninstall` with no arguments; passing requirement names that all fail to parse into a valid InstallRequirement.name (e.g. bare URLs with no project name); passing -r with an empty file or a file whose entries are all filtered out.","commonSituations":"Typing `pip uninstall` without a package name; scripts that pass an empty list or empty requirements file; passing a requirements.txt that contains only comments or invalid lines.","solutions":["Provide at least one package name: `pip uninstall <package>`.","If using -r, ensure the requirements file is non-empty and contains valid package specifiers.","Use `pip uninstall -y <package>` to avoid the confirmation prompt when scripting.","If building the arg list dynamically, check it is non-empty before calling pip."],"exampleFix":"# before\npip uninstall\n# after\npip uninstall -y requests","handlingStrategy":"validation","validationCode":"def run_pip_uninstall(packages: list[str]) -> list[str]:\n    if not packages:\n        raise ValueError('pip uninstall requires at least one package name')\n    return ['pip', 'uninstall', '-y', *packages]\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the package list is non-empty before invoking pip uninstall.","Validate -r requirements files are non-empty before use."],"tags":["pip","uninstall","cli","arguments"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}