- Python 3.11 or higher installed
- pip (Python package manager)
- Git installed
python --versionShould output: Python 3.11.x or higher
If you need to install Python, download from python.org
It's best practice to use a virtual environment for each project.
python -m venv venv
.\venv\Scripts\Activate.ps1python -m venv venv
source venv/Scripts/activatepython3 -m venv venv
source venv/bin/activateYou should see (venv) at the beginning of your terminal prompt.
Create a requirements.txt file in your project directory if you haven't already:
google-cloud-aiplatform>=1.26.0
vertexai>=0.1.0
python-dotenv>=1.0.0
streamlit>=1.28.0
requests>=2.31.0Install all packages:
pip install -r requirements.txtCreate a test script test_setup.py:
import sys
print(f"Python version: {sys.version}")
try:
from google.cloud import aiplatform
print("✅ google-cloud-aiplatform installed")
except ImportError:
print("❌ google-cloud-aiplatform not found")
try:
import streamlit
print("✅ streamlit installed")
except ImportError:
print("❌ streamlit not found")
try:
import dotenv
print("✅ python-dotenv installed")
except ImportError:
print("❌ python-dotenv not found")
print("\n✅ All packages installed successfully!")Run it:
python test_setup.pyCreate a .env file in your project root if you haven't already:
GCP_PROJECT_ID=your-project-id
GCP_LOCATION=us-central1
GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/key.jsonLoad it in your Python code:
from dotenv import load_dotenv
import os
load_dotenv()
project_id = os.getenv("GCP_PROJECT_ID")
location = os.getenv("GCP_LOCATION")When you're done working:
deactivate- Python is not installed or not in PATH
- Try
python3instead ofpython
- On Windows, you may need to run PowerShell as Administrator
- Or use Git Bash instead
- Ensure virtual environment is activated (you should see
(venv)in prompt) - Run
pip install -r requirements.txtagain
- Install Python extension
- Select interpreter:
Ctrl+Shift+P→ "Python: Select Interpreter" - Choose the one in your
venvfolder
- Go to Settings → Project → Python Interpreter
- Click gear icon → Add
- Select "Existing Environment"
- Navigate to
venv/Scripts/python.exe(Windows) orvenv/bin/python(macOS/Linux)
- GCP Setup Guide
- Vertex AI Quickstart
- Start coding!
Documentation: