Skip to content

Fix virtual environment activation path on Windows#393

Open
yuribodo wants to merge 1 commit intoanthropics:mainfrom
yuribodo:fix/windows-venv-activation-129
Open

Fix virtual environment activation path on Windows#393
yuribodo wants to merge 1 commit intoanthropics:mainfrom
yuribodo:fix/windows-venv-activation-129

Conversation

@yuribodo
Copy link
Copy Markdown

@yuribodo yuribodo commented Apr 17, 2026

Summary

Fixes #129. The computer-use-demo/setup.sh script hardcoded source .venv/bin/activate, which works on Linux/macOS but fails on Windows (Git Bash / MSYS2 / Cygwin) where Python creates the activation script at .venv/Scripts/activate instead.

Change

Check which activation script the freshly-created venv actually contains, rather than trying to enumerate Windows bash variants via $OSTYPE:

if [ -f .venv/Scripts/activate ]; then
    source .venv/Scripts/activate
else
    source .venv/bin/activate
fi

This is self-documenting, doesn't maintain an OS taxonomy (msys vs msys2 vs cygwin vs ...), and matches what tools like uv and hatch do internally.

Scope

This PR only fixes the setup.sh activation step — the rest of the Windows story (Rust/cargo build, Docker runtime, pre-commit hooks) is out of scope and not claimed to be fixed here.

Test plan

  • bash -n computer-use-demo/setup.sh passes syntax check
  • Linux/macOS behavior unchanged: .venv/Scripts/activate won't exist, so the else branch runs exactly as before
  • Windows (Git Bash / MSYS2): venv creates .venv/Scripts/activate, the if branch sources it

The setup.sh script was hardcoded to use .venv/bin/activate, which fails
on Windows where Python creates .venv/Scripts/activate instead. This
adds an OSTYPE check to select the correct path on msys/cygwin shells
while preserving the existing behavior on Linux and macOS.

Fixes anthropics#129
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.

Inconsistent Virtual Environment Activation Path for Windows in setup.sh Script

1 participant