Skip to content

Commit 3c5ba46

Browse files
committed
Support the new location of PipSession
1 parent 9a352a2 commit 3c5ba46

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pip_check_reqs/common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
import re
77

88
from packaging.utils import canonicalize_name
9-
from pip._internal.download import PipSession
9+
# Between different versions of pip the location of PipSession has changed.
10+
try:
11+
from pip._internal.network.session import PipSession
12+
except ImportError: # pragma: no cover
13+
from pip._internal.download import PipSession
1014
from pip._internal.req.req_file import parse_requirements
1115

1216
log = logging.getLogger(__name__)

pip_check_reqs/find_missing_reqs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
from packaging.utils import canonicalize_name
88
from pip._internal.commands.show import search_packages_info
9-
from pip._internal.download import PipSession
9+
# Between different versions of pip the location of PipSession has changed.
10+
try:
11+
from pip._internal.network.session import PipSession
12+
except ImportError: # pragma: no cover
13+
from pip._internal.download import PipSession
1014
from pip._internal.req.req_file import parse_requirements
1115
from pip._internal.utils.misc import get_installed_distributions
1216

0 commit comments

Comments
 (0)