Skip to content

Commit

Permalink
fix error message in case of missing Python packages
Browse files Browse the repository at this point in the history
  • Loading branch information
senko committed Jun 6, 2024
1 parent 2d56905 commit 984caed
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@

try:
from core.cli.main import run_pythagora
except ImportError:
pythagora_root = os.path.dirname(os.path.dirname(__file__))
except ImportError as err:
pythagora_root = os.path.dirname(__file__)
venv_path = os.path.join(pythagora_root, "venv")
requirements_path = os.path.join(pythagora_root, "requirements.txt")
if sys.prefix == sys.base_prefix:
venv_python_path = os.path.join(venv_path, "scripts" if sys.platform == "win32" else "bin", "python")
print("Python environment for Pythagora is not set up.", file=sys.stderr)
print(f"Python environment for Pythagora is not set up: module `{err.name}` is missing.", file=sys.stderr)
print(f"Please create Python virtual environment: {sys.executable} -m venv {venv_path}", file=sys.stderr)
print(
f"Then install the required dependencies with: {venv_python_path} -m pip install -r {requirements_path}",
file=sys.stderr,
)
else:
print("Python environment for Pythagora is not completely set up.", file=sys.stderr)
print(
f"Python environment for Pythagora is not completely set up: module `{err.name}` is missing",
file=sys.stderr,
)
print(
f"Please run `{sys.executable} -m pip install -r {requirements_path}` to finish Python setup, and rerun Pythagora.",
file=sys.stderr,
Expand Down

0 comments on commit 984caed

Please sign in to comment.