We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa3c9e0 commit d89c0e4Copy full SHA for d89c0e4
python/sglang/check_env.py
@@ -1,6 +1,6 @@
1
"""Check environment configurations and dependency versions."""
2
3
-import importlib
+import importlib.metadata
4
import os
5
import resource
6
import subprocess
@@ -59,9 +59,8 @@ def get_package_versions(packages):
59
for package in packages:
60
package_name = package.split("==")[0].split(">=")[0].split("<=")[0]
61
try:
62
- module = importlib.import_module(package_name)
63
- if hasattr(module, "__version__"):
64
- versions[package_name] = module.__version__
+ version = importlib.metadata.version(package_name)
+ versions[package_name] = version
65
except ModuleNotFoundError:
66
versions[package_name] = "Module Not Found"
67
return versions
0 commit comments