Try statement to capture missing imports

hopefully will catch those whom don't reinstall requirements
This commit is contained in:
erew123 authored and GitHub committed 2024-11-24 11:30:03 +00:00
1 parent c0498ed8c9
commit 3cb30504e5
1 file changed
+19 -3
+19 -3
View File
@@ -70,15 +70,31 @@ from datetime import datetime, timedelta
from pathlib import Path from pathlib import Path
import gradio as gr import gradio as gr
import numpy as np import numpy as np
import plotly.graph_objects as go
import requests import requests
from requests.exceptions import ConnectionError as RequestsConnectionError from requests.exceptions import ConnectionError as RequestsConnectionError
from requests.exceptions import RequestException from requests.exceptions import RequestException
from scipy import signal as scipy_signal
import soundfile as sf import soundfile as sf
from tqdm import tqdm from tqdm import tqdm
import torch import torch
import whisper try:
import whisper
import soundfile as sf
import plotly.graph_objects as go
from scipy import signal as scipy_signal
except ImportError as e:
print(f"Error: {e}")
print("=" * 50)
print("🚨 Missing Dependencies Detected 🚨\n")
print(
"It seems you are missing some required packages.\n"
"To resolve this, please install the dependencies by running:\n"
)
print(" 🔹 pip install -r system/requirements/requirements_standalone.txt")
print(" 🔹 or use the 'atsetup' command\n")
print("Once the installation is complete, try running the script again.")
print("=" * 50)
sys.exit(1) # Exit the script to avoid further errors
this_dir = Path(__file__).parent.resolve() this_dir = Path(__file__).parent.resolve()
# Note: The following function names are reserved for TGWUI integration. # Note: The following function names are reserved for TGWUI integration.