Skip to content

fix(ansible): ai-stack role uses python3.12 for venv + fix pip cache (#3534)#3536

Merged
mrveiss merged 1 commit intoDev_new_guifrom
issue-3534
Apr 5, 2026
Merged

fix(ansible): ai-stack role uses python3.12 for venv + fix pip cache (#3534)#3536
mrveiss merged 1 commit intoDev_new_guifrom
issue-3534

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Apr 5, 2026

Summary

  • Root cause: ai-stack Ansible role created the venv with python3 (resolves to Python 3.10 on target hosts), but requirements-ai.txt requires numpy>=2.4.3 which only exists for Python 3.11+. The backend role correctly uses python3.12; the ai-stack role did not.
  • Stale venv guard: Added version check before creation so a pre-existing Python 3.10 venv is removed rather than silently reused (the creates: guard would otherwise skip re-creation).
  • Pip cache: autobot-ai service account has create_home: false so ~/.cache/pip never exists. Added pip cache dir under ai_data_dir and set HOME env var on all pip tasks to suppress the warning and enable caching. Closes bug(ansible): autobot-ai pip cache dir not owned by autobot-ai — cache disabled on every AI stack install #3535.

Changes

autobot-slm-backend/ansible/roles/ai-stack/tasks/main.yml:

  • Add "Check existing venv Python version" — failed_when: false so it's a no-op on first deploy
  • Add "Remove stale venv if not Python 3.12" — removes 3.10 venv before re-creation
  • python3 -m venvpython3.12 -m venv
  • Add "Create pip cache directory for ai user" under ai_data_dir/.cache/pip
  • Add HOME: "{{ ai_data_dir }}" to all three pip tasks (upgrade pip, install from requirements, fallback install)

Test plan

  • Re-run fleet provisioning against a node with ai-stack role — Phase 5a should succeed
  • Verify venv is at .../venv/lib/python3.12/site-packages on target host
  • Verify no pip cache warning in provisioning output
  • Re-run against a host with a pre-existing Python 3.10 venv — stale venv is detected and removed

Closes #3534
Closes #3535

🤖 Generated with Claude Code

…3534)

- Change venv creation from python3 (3.10) to python3.12 — required by
  numpy>=2.4.3 in requirements-ai.txt (numpy 2.3+ needs Python 3.11+)
- Add stale-venv detection: check existing venv Python version and remove
  if not 3.12, so the creates: guard does not silently skip re-creation
- Create pip cache dir under ai_data_dir and set HOME env var for all pip
  tasks — autobot-ai has create_home:false so ~/.cache/pip never exists (#3535)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

@mrveiss
Copy link
Copy Markdown
Owner Author

mrveiss commented Apr 5, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant