#!/usr/bin/env python3
"""Trace actual runtime imports from server.py to find ALL missing deps."""
import subprocess, sys

# Check which pip packages are installed vs which are imported
cmd = """
cd /opt/qwen3-tts
python3 -c "
import importlib, sys

# All third-party modules found in the grep scan
third_party = [
    'gguf', 'torch', 'transformers', 'yaml', 'tqdm',
    'sounddevice', 'PySide6', 'onnxruntime', 'numpy',
    'scipy', 'soundfile', 'tokenizers', 'flask', 'requests'
]

for mod in third_party:
    try:
        importlib.import_module(mod)
        print(f'OK   {mod}')
    except ImportError:
        print(f'MISS {mod}')
"
"""
result = subprocess.run(
    ["docker", "run", "--rm", "--entrypoint", "bash", "sudx/qwen3-tts:latest", "-c", cmd],
    capture_output=True, text=True
)
print(result.stdout)
if result.stderr:
    print("STDERR:", result.stderr[-500:], file=sys.stderr)
