From 5158a104537625c344033e107193074e0dda07f1 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Thu, 3 Apr 2025 13:01:42 -0400 Subject: [PATCH] fix python path not found issue (#2094) --- integrations/mcp/README.md | 2 ++ pyproject.toml | 2 +- skyvern/cli/commands.py | 23 ++++++++++++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/integrations/mcp/README.md b/integrations/mcp/README.md index 201a20bb..7faddaac 100644 --- a/integrations/mcp/README.md +++ b/integrations/mcp/README.md @@ -19,6 +19,8 @@ You can connect your MCP-enabled applications to Skyvern in two ways: - Get the API key from the settings page which will be used for setup ## Quickstart +> ⚠️ **REQUIREMENT**: Skyvern only runs in Python 3.11 environment today ⚠️ + 1. **Install Skyvern** ```bash pip install skyvern diff --git a/pyproject.toml b/pyproject.toml index abf13c75..32269113 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "skyvern" -version = "0.1.72" +version = "0.1.73" description = "" authors = ["Skyvern AI "] readme = "README.md" diff --git a/skyvern/cli/commands.py b/skyvern/cli/commands.py index d021e76c..09d41b6a 100644 --- a/skyvern/cli/commands.py +++ b/skyvern/cli/commands.py @@ -569,13 +569,22 @@ def setup_mcp_config() -> str: """ return the path to the python environment """ - python_path = shutil.which("python") - if python_path: - use_default = typer.prompt(f"Found Python at {python_path}. Use this path? (y/n)").lower() == "y" - if use_default: - path_to_env = python_path - else: - path_to_env = typer.prompt("Enter the full path to your configured python environment") + # Try to find Python in this order: python, python3, python3.12, python3.11, python3.10, python3.9 + python_paths = [] + for python_cmd in ["python", "python3.11"]: + python_path = shutil.which(python_cmd) + if python_path: + python_paths.append((python_cmd, python_path)) + + if not python_paths: + print("Error: Could not find any Python installation. Please install Python 3.11 first.") + path_to_env = typer.prompt( + "Enter the full path to your python 3.11 environment. For example in MacOS if you installed it using Homebrew, it would be /opt/homebrew/bin/python3.11" + ) + else: + # Show the first found Python as default + _, default_path = python_paths[0] + path_to_env = default_path return path_to_env