diff --git a/run_setup.py b/run_setup.py index cd18fec..542d49a 100644 --- a/run_setup.py +++ b/run_setup.py @@ -28,8 +28,6 @@ import argparse from pathlib import Path from typing import Dict -import psycopg2 - SQL_DIR = Path(__file__).parent / "sql" CONFIG_FILE = Path(__file__).parent / "db_config.json" @@ -150,6 +148,13 @@ def main() -> int: p.add_argument("--yes", action="store_true", help="Skip confirmation prompts") args = p.parse_args() + try: + import psycopg2 + except ModuleNotFoundError: + print("[FAIL] psycopg2 not installed. Run inside an environment that has " + "it (e.g. the TSAPI_SERIESDB_PG_PY venv), or: pip install psycopg2-binary") + return 1 + cfg = load_config(args) print("=" * 70)