mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-11-27 06:40:10 +08:00
use pip freeze --all to get packages
This commit is contained in:
parent
7d7f7f4b49
commit
11f827c58b
@ -4,7 +4,6 @@ import sys
|
|||||||
|
|
||||||
import platform
|
import platform
|
||||||
import hashlib
|
import hashlib
|
||||||
import pkg_resources
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import launch
|
import launch
|
||||||
@ -88,6 +87,19 @@ def get_ram_info():
|
|||||||
return str(e)
|
return str(e)
|
||||||
|
|
||||||
|
|
||||||
|
def get_packages():
|
||||||
|
try:
|
||||||
|
import subprocess
|
||||||
|
return subprocess.check_output([sys.executable, '-m', 'pip', 'freeze', '--all']).decode("utf8").splitlines()
|
||||||
|
except Exception as pip_error:
|
||||||
|
try:
|
||||||
|
import importlib.metadata
|
||||||
|
packages = importlib.metadata.distributions()
|
||||||
|
return sorted([f"{package.metadata['Name']}=={package.version}" for package in packages])
|
||||||
|
except Exception as e2:
|
||||||
|
return {'error pip': pip_error, 'error importlib': str(e2)}
|
||||||
|
|
||||||
|
|
||||||
def get_dict():
|
def get_dict():
|
||||||
res = {
|
res = {
|
||||||
"Platform": platform.platform(),
|
"Platform": platform.platform(),
|
||||||
@ -108,7 +120,7 @@ def get_dict():
|
|||||||
"Environment": get_environment(),
|
"Environment": get_environment(),
|
||||||
"Config": get_config(),
|
"Config": get_config(),
|
||||||
"Startup": timer.startup_record,
|
"Startup": timer.startup_record,
|
||||||
"Packages": sorted([f"{pkg.key}=={pkg.version}" for pkg in pkg_resources.working_set]),
|
"Packages": get_packages(),
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
Loading…
Reference in New Issue
Block a user