Skip to content

Commit 8b3f784

Browse files
committed
Update message
1 parent 98fe991 commit 8b3f784

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/pip/_internal/exceptions.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,11 +788,19 @@ def __init__(
788788
package: "AlreadyInstalledCandidate",
789789
invalid_req_exc: "InvalidRequirement",
790790
) -> None:
791+
installed_location = package.dist.installed_location
791792
super().__init__(
792793
message=Text(
793-
f"Cannot uninstall {package} because it has an invalid requirement:\n"
794-
f"{invalid_req_exc.args[0]}."
794+
f"Cannot process installed package {package} "
795+
+ (f"in {installed_location!r} " if installed_location else "")
796+
+ f"because it has an invalid requirement:\n{invalid_req_exc.args[0]}"
797+
),
798+
context=(
799+
"Starting with pip 24.1, packages with invalid "
800+
"requirements can not be processed."
801+
),
802+
hint_stmt=(
803+
"To proceed this package must be uninstalled using 'pip<24.1', "
804+
"some other Python package tool, or manually deleted."
795805
),
796-
context="Since pip 24.1+ invalid requirements can not be read by pip.",
797-
hint_stmt="Please use 'pip<24.1' if you need to uninstall this package.",
798806
)

0 commit comments

Comments
 (0)