2023-07-26 12:26:29 +00:00
|
|
|
"""
|
|
|
|
Check that the invokeai_root is correctly configured and exit if not.
|
|
|
|
"""
|
2024-02-29 23:04:59 +00:00
|
|
|
|
2023-07-26 12:26:29 +00:00
|
|
|
import sys
|
2023-08-18 15:13:28 +00:00
|
|
|
|
|
|
|
from invokeai.app.services.config import InvokeAIAppConfig
|
2023-07-26 12:26:29 +00:00
|
|
|
|
2023-07-27 14:54:01 +00:00
|
|
|
|
2023-07-26 12:26:29 +00:00
|
|
|
def check_invokeai_root(config: InvokeAIAppConfig):
|
|
|
|
try:
|
2023-07-26 14:47:37 +00:00
|
|
|
assert config.db_path.parent.exists(), f"{config.db_path.parent} not found"
|
|
|
|
assert config.models_path.exists(), f"{config.models_path} not found"
|
|
|
|
except Exception as e:
|
2023-07-26 12:26:29 +00:00
|
|
|
print()
|
2023-07-26 14:47:37 +00:00
|
|
|
print(f"An exception has occurred: {str(e)}")
|
2023-07-26 12:26:29 +00:00
|
|
|
print("== STARTUP ABORTED ==")
|
|
|
|
print("** One or more necessary files is missing from your InvokeAI root directory **")
|
2023-07-26 12:30:01 +00:00
|
|
|
print("** Please rerun the configuration script to fix this problem. **")
|
2023-12-22 03:31:58 +00:00
|
|
|
print("** From the launcher, selection option [6]. **")
|
2023-07-26 12:30:01 +00:00
|
|
|
print(
|
|
|
|
'** From the command line, activate the virtual environment and run "invokeai-configure --yes --skip-sd-weights" **'
|
|
|
|
)
|
2023-07-26 12:26:29 +00:00
|
|
|
input("Press any key to continue...")
|
|
|
|
sys.exit(0)
|