Files
PromptTech/backend/PYTHON_INTERPRETER_FIX.md

1.2 KiB

VS Code Python Interpreter Configuration

The red import errors you're seeing are because VS Code needs to be configured to use the virtual environment.

Quick Fix

  1. Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
  2. Type: Python: Select Interpreter
  3. Choose: ./venv/bin/python or Python 3.x.x ('venv': venv)

Alternative: Check .vscode/settings.json

Ensure this file exists in your project root with:

{
    "python.defaultInterpreterPath": "${workspaceFolder}/backend/venv/bin/python",
    "python.terminal.activateEnvironment": true,
    "python.analysis.extraPaths": [
        "${workspaceFolder}/backend"
    ]
}

Verify Installation

The files are actually working correctly. You can verify by running:

cd backend
source venv/bin/activate
python check_database_health.py  # Works!
python test_upload.py            # Works!
python optimize_database.py      # Works!

The 3 Files Showing Red (but working correctly)

  1. optimize_database.py - Database optimization script
  2. check_database_health.py - Database health monitoring
  3. test_upload.py - Image upload testing utility

All dependencies are installed in backend/venv/ - just need to tell VS Code to use it.