Skip to content

Commit 5e25be6

Browse files
committed
fix(coral-tpu): drop pycoral — ai-edge-litert supports Python 3.9-3.13
pycoral was never imported by detect.py or tpu_probe.py — both use ai-edge-litert directly. Removing pycoral from the deploy scripts means: - No Python version pinning needed (works with any python3) - No pyenv installation on Linux - No brew install python@3.9 on macOS - Works out of the box with system Python 3.12 or 3.13 Tested: ai_edge_litert imports cleanly on Python 3.12.13
1 parent b6faafd commit 5e25be6

File tree

2 files changed

+14
-54
lines changed

2 files changed

+14
-54
lines changed

skills/detection/yolo-detection-2026-coral-tpu/deploy-linux.sh

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -94,44 +94,13 @@ else
9494
exit 1
9595
fi
9696

97-
# ─── Step 2: Find or install Python 3.9 ─────────────────────────────────────
98-
# PyCoral pip wheels are only available for Python 3.6–3.9 on Linux.
99-
# We lock to 3.9 regardless of the system Python version via pyenv.
100-
emit '{"event": "progress", "stage": "python", "message": "Resolving Python 3.9..."}'
101-
102-
PYTHON_CMD=""
103-
104-
# Check for python3.9 natively first (fastest path)
105-
if command -v python3.9 &>/dev/null; then
106-
PYTHON_CMD="python3.9"
107-
log "Found native python3.9: $(python3.9 --version)"
108-
else
109-
log "python3.9 not found — attempting pyenv install..."
110-
emit '{"event": "progress", "stage": "python", "message": "python3.9 not found — installing via pyenv..."}'
111-
112-
# Install pyenv if missing
113-
if ! command -v pyenv &>/dev/null; then
114-
log "Installing pyenv..."
115-
curl -sSL https://pyenv.run | bash
116-
# Add pyenv to PATH for this session
117-
export PYENV_ROOT="$HOME/.pyenv"
118-
export PATH="$PYENV_ROOT/bin:$PATH"
119-
eval "$(pyenv init -)"
120-
else
121-
export PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}"
122-
export PATH="$PYENV_ROOT/bin:$PATH"
123-
eval "$(pyenv init -)"
124-
fi
125-
126-
# Install Python 3.9.x via pyenv
127-
if ! pyenv versions --bare | grep -q "^3\.9"; then
128-
emit '{"event": "progress", "stage": "python", "message": "pyenv: compiling Python 3.9 (this may take a few minutes)..."}'
129-
pyenv install 3.9.18
130-
fi
131-
132-
PYTHON_CMD="$(pyenv root)/versions/$(pyenv versions --bare | grep "^3\.9" | tail -1)/bin/python3"
97+
# ─── Step 2: Find Python 3 ──────────────────────────────────────────────
98+
# ai-edge-litert supports Python 3.9–3.13. No version pinning needed.
99+
if ! command -v python3 &>/dev/null; then
100+
emit '{"event": "error", "stage": "python", "message": "Python 3 not found. Install via your package manager."}'
101+
exit 1
133102
fi
134-
103+
PYTHON_CMD="python3"
135104
log "Using Python: $($PYTHON_CMD --version)"
136105

137106
# ─── Step 3: Create isolated venv ────────────────────────────────────────────
@@ -146,13 +115,8 @@ fi
146115

147116
"$VENV_DIR/bin/python" -m pip install --upgrade pip >/dev/null 2>&1 || true
148117

149-
# ─── Step 4: Install PyCoral via pip (works with Python 3.9 wheels) ──────────
150-
emit '{"event": "progress", "stage": "build", "message": "Installing PyCoral 2.0 wheels from Google..."}'
151-
if ! "$VENV_DIR/bin/python" -m pip install --extra-index-url https://google-coral.github.io/py-repo/ pycoral~=2.0; then
152-
emit '{"event": "error", "stage": "build", "message": "pip install pycoral failed"}'
153-
exit 1
154-
fi
155-
118+
# ─── Step 4: Install dependencies ──────────────────────────────────────────────
119+
emit '{"event": "progress", "stage": "build", "message": "Installing ai-edge-litert and dependencies..."}'
156120
if ! "$VENV_DIR/bin/python" -m pip install -r "$SKILL_DIR/requirements.txt"; then
157121
emit '{"event": "error", "stage": "build", "message": "pip install requirements failed"}'
158122
exit 1

skills/detection/yolo-detection-2026-coral-tpu/deploy-macos.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ sudo bash install.sh"
9595
rm -rf "$TMP_DIR"
9696
fi
9797

98-
# ─── Python venv + pycoral ───────────────────────────────────────────────────
99-
# macOS ships Python 3.9 via Homebrew or Xcode. PyCoral official wheels support <=3.9.
98+
# ─── Python venv + dependencies ─────────────────────────────────────────────
99+
# ai-edge-litert (the inference engine) supports Python 3.9-3.13.
100+
# No need to pin to Python 3.9 — use whatever python3 is available.
100101
PYTHON_CMD="python3"
101102
if ! command -v python3 &>/dev/null; then
102-
emit '{"event": "error", "stage": "python", "message": "Python 3 not found. Install via: brew install python@3.9"}'
103+
emit '{"event": "error", "stage": "python", "message": "Python 3 not found. Install via: brew install python"}'
103104
exit 1
104105
fi
105106
log "Using Python: $($PYTHON_CMD --version)"
@@ -110,13 +111,8 @@ emit '{"event": "progress", "stage": "build", "message": "Creating Python virtua
110111

111112
"$VENV_DIR/bin/python" -m pip install --upgrade pip >/dev/null 2>&1 || true
112113

113-
emit '{"event": "progress", "stage": "build", "message": "Installing PyCoral and dependencies..."}'
114-
if ! "$VENV_DIR/bin/python" -m pip install --extra-index-url https://google-coral.github.io/py-repo/ pycoral~=2.0; then
115-
emit '{"event": "error", "stage": "build", "message": "pip install pycoral failed — ensure Python 3.9 is active (brew install python@3.9)"}'
116-
exit 1
117-
fi
118-
119-
if ! "$VENV_DIR/bin/python" -m pip install -r "$SKILL_DIR/requirements.txt"; then
114+
emit '{"event": "progress", "stage": "build", "message": "Installing dependencies (ai-edge-litert, numpy, Pillow)..."}'
115+
if ! "$VENV_DIR/bin/python" -m pip install --extra-index-url https://google-coral.github.io/py-repo/ -r "$SKILL_DIR/requirements.txt"; then
120116
emit '{"event": "error", "stage": "build", "message": "pip install requirements failed"}'
121117
exit 1
122118
fi

0 commit comments

Comments
 (0)