{"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/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/commands/uninstall.py#L74-L110","documentation":"Raised as InstallationError in UninstallCommand.run() at uninstall.py:91-95 when, after parsing both positional package arguments and -r requirements files, the reqs_to_uninstall dict is empty. pip needs at least one named requirement to uninstall; it will not proceed with nothing to act on.","triggerScenarios":"Running 'pip uninstall' with no package args and no -r file; supplying only requirements files that are empty or contain no named requirements; supplying args that all fail to parse into named requirements (logged as warnings at uninstall.py:76-81 and then the dict is still empty).","commonSituations":"Typo leaving off the package name; a requirements file path that is empty or all comments; passing URL-only or unnamed requirement specifiers that produce no req.name.","solutions":["Add at least one package name: 'pip uninstall <package>'.","Verify your -r file contains named 'package==version' lines, not just comments or URLs.","If you passed requirement specifiers, ensure each has a name; check the 'Invalid requirement ... ignored' warnings printed above the error.","Use 'pip uninstall --help' to confirm the expected argument syntax."],"exampleFix":"# before\npip uninstall\n# after\npip uninstall requests","handlingStrategy":"validation","validationCode":"import sys, os\nreqs = [a for a in sys.argv[1:] if not a.startswith('-')]\n# also account for -r files\nr_files = []\nfor i,a in enumerate(sys.argv):\n    if a in ('-r','--requirement') and i+1 < len(sys.argv):\n        r_files.append(sys.argv[i+1])\nhas_named_in_files = any(any(not l.startswith('#') and l.strip() for l in open(f)) for f in r_files if os.path.exists(f))\nif not reqs and not has_named_in_files:\n    print('ERROR: pip uninstall requires at least one package or a non-empty -r file', file=sys.stderr)\n    sys.exit(2)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply at least one named package or a populated -r file to pip uninstall.","Validate that requirements files contain at least one non-comment line before passing them.","Heed 'Invalid requirement ... ignored' warnings — they indicate args that did not yield names."],"tags":["pip","uninstall","missing-argument","cli"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}