File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,20 @@ def installed_packages():
18
18
19
19
Notes
20
20
-----
21
- Uses pip freeze functionality so pip module must be present.
21
+ Uses pip freeze functionality so pip module must be present. For pip
22
+ versions >=20.1, this functionality fails to provide versions for some
23
+ conda installed, locally installed, and url installed packages. Instead
24
+ uses the pkg_resources package which is typically bundled with pip.
22
25
23
26
"""
27
+ from packaging import version
24
28
try :
25
- from pip ._internal .operations import freeze
29
+ import pip
30
+ if version .parse (pip .__version__ ) >= version .parse ("20.1" ):
31
+ import pkg_resources
32
+ return [p .project_name + "==" + p .version for p in pkg_resources .working_set ]
33
+ else :
34
+ from pip ._internal .operations import freeze
26
35
except ImportError :
27
36
try :
28
37
from pip .operations import freeze
You can’t perform that action at this time.
0 commit comments