Skip to content

Commit db13fb5

Browse files
authored
BUG: Allow show_versions to work for any module that raises an exception (#59114)
* BUG: Allow show_versions to work for any module that raises an exception * Remove setuptools
1 parent f2eeb4e commit db13fb5

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

pandas/util/_print_versions.py

+9-17
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _get_sys_info() -> dict[str, JSONSerializable]:
4545
language_code, encoding = locale.getlocale()
4646
return {
4747
"commit": _get_commit_hash(),
48-
"python": ".".join([str(i) for i in sys.version_info]),
48+
"python": platform.python_version(),
4949
"python-bits": struct.calcsize("P") * 8,
5050
"OS": uname_result.system,
5151
"OS-release": uname_result.release,
@@ -70,33 +70,25 @@ def _get_dependency_info() -> dict[str, JSONSerializable]:
7070
"pytz",
7171
"dateutil",
7272
# install / build,
73-
"setuptools",
7473
"pip",
7574
"Cython",
76-
# test
77-
"pytest",
78-
"hypothesis",
7975
# docs
8076
"sphinx",
81-
# Other, need a min version
82-
"blosc",
83-
"feather",
84-
"xlsxwriter",
85-
"lxml.etree",
86-
"html5lib",
87-
"pymysql",
88-
"psycopg2",
89-
"jinja2",
9077
# Other, not imported.
9178
"IPython",
92-
"pandas_datareader",
9379
]
80+
# Optional dependencies
9481
deps.extend(list(VERSIONS))
9582

9683
result: dict[str, JSONSerializable] = {}
9784
for modname in deps:
98-
mod = import_optional_dependency(modname, errors="ignore")
99-
result[modname] = get_version(mod) if mod else None
85+
try:
86+
mod = import_optional_dependency(modname, errors="ignore")
87+
except Exception:
88+
# Dependency conflicts may cause a non ImportError
89+
result[modname] = "N/A"
90+
else:
91+
result[modname] = get_version(mod) if mod else None
10092
return result
10193

10294

0 commit comments

Comments
 (0)