|
import platform |
|
import subprocess |
|
import os |
|
|
|
|
|
system = platform.system() |
|
release = platform.release() |
|
version = platform.version() |
|
machine = platform.machine() |
|
processor = platform.processor() |
|
|
|
|
|
print("System Information:") |
|
print(f"System: {system}, Release: {release}, Version: {version}, Machine: {machine}, Processor: {processor}") |
|
|
|
|
|
python_version = platform.python_version() |
|
python_implementation = platform.python_implementation() |
|
python_compiler = platform.python_compiler() |
|
|
|
|
|
print("\nPython Information:") |
|
print(f"Version: {python_version}, Implementation: {python_implementation}, Compiler: {python_compiler}") |
|
|
|
|
|
venv = os.environ.get('VIRTUAL_ENV', None) |
|
|
|
|
|
if venv: |
|
print("\nVirtual Environment Information:") |
|
print(f"Path: {venv}") |
|
else: |
|
print("\nVirtual Environment Information:") |
|
print("Not running inside a virtual environment.") |
|
|
|
|
|
try: |
|
output = subprocess.check_output(['nvidia-smi', '--query-gpu=name,memory.total', '--format=csv']) |
|
output = output.decode('utf-8').strip().split('\n')[1:] |
|
gpu_info = [line.split(', ') for line in output] |
|
gpu_name, gpu_vram = gpu_info[0] |
|
gpu_vram = gpu_vram.replace(' MiB', '') |
|
gpu_vram_warning = int(gpu_vram) < 8000 |
|
except (subprocess.CalledProcessError, FileNotFoundError): |
|
gpu_name, gpu_vram = "N/A", "N/A" |
|
gpu_vram_warning = False |
|
|
|
|
|
print("\nGPU Information:") |
|
print(f"Name: {gpu_name}, VRAM: {gpu_vram} MiB") |
|
|
|
|
|
if gpu_vram_warning: |
|
print('\033[33mWarning: GPU VRAM is less than 8GB and will likelly result in proper operations.\033[0m') |
|
|
|
print(' ') |
|
|