Skip to content

Instantly share code, notes, and snippets.

@ElijahLynn
Created June 8, 2026 21:59
Show Gist options
  • Select an option

  • Save ElijahLynn/c93768dd09ac727948ad3b01af7a001a to your computer and use it in GitHub Desktop.

Select an option

Save ElijahLynn/c93768dd09ac727948ad3b01af7a001a to your computer and use it in GitHub Desktop.
Cursor: Python + Ansible extension compatibility fix (PET binary, pinned Python 2024.20.0)

Cursor: Python + Ansible Extension Compatibility

Notes for fixing extension activation failures and Python environment warnings when using Ansible 26.6+, Python Environments, and ms-python.python in Cursor on macOS.

Tested on Cursor ~1.105 (VS Code 1.105 base), macOS arm64, June 2026.

Symptoms

  • Notification: "Extension activation failed" — root cause is usually ms-python.python
  • Log error:
    TypeError: Cannot read properties of undefined (reading 'onDidChangeEnvironment')
      at createEnvExtApi (ms-python.python-2025.6.1)
    
  • Ansible warning: "Python environment discovery is degraded (PET binary missing). This commonly occurs in OpenVSX-based editors (Dev Spaces, VSCodium)."
  • Ansible prompt: "The Python Environments extension requires 'python.useEnvironmentsExtension' to be enabled..."

Root cause

Three extensions interact badly in Cursor:

Extension Issue
ms-python.python 2025.6.x Calls Python Environments API during activation; crashes in Cursor's extension host
ms-python.vscode-python-envs Required by Ansible 26.6+; OpenVSX universal build omits native PET binary
redhat.ansible 26.6+ Hard-depends on both extensions above; checks for PET in python-envs install dir

Not the cause: Pylance capped at 2024.8.1 in Cursor — that is expected, not a bug.

Ansible cannot uninstall ms-python.vscode-python-envs — it is a declared dependency:

"extensionDependencies": [
  "ms-python.python",
  "ms-python.vscode-python-envs",
  "redhat.vscode-yaml"
]

Fix

1. Downgrade and pin Python extension

Install a version before the broken envs API integration:

cursor --install-extension ms-python.python@2024.20.0

Verify:

cursor --list-extensions --show-versions | rg ms-python.python
# ms-python.python@2024.20.0

Pin it so Cursor does not auto-upgrade back to 2025.6.x:

  1. Extensions → Python → gear icon → Disable Auto Update
  2. Confirm "pinned": true in ~/.cursor/extensions/extensions.json for ms-python.python

If upgraded accidentally, reinstall:

cursor --install-extension ms-python.python@2024.20.0

2. Provide PET binary for Python Environments (OpenVSX workaround)

OpenVSX universal builds of ms-python.vscode-python-envs lack python-env-tools/bin/pet. Ansible checks for PET in the python-envs extension directory, not the Python extension directory.

Copy PET from the (platform-specific) Python extension, or from a prior install:

PYTHON_EXT="$HOME/.cursor/extensions/ms-python.python-2024.20.0"
ENVS_EXT="$HOME/.cursor/extensions/ms-python.vscode-python-envs-1.10.0-universal"

mkdir -p "$PYTHON_EXT/python-env-tools/bin"
# if pet missing in 2024.20.0, copy from an older darwin-arm64 python extension:
# cp "$HOME/.cursor/extensions/ms-python.python-2025.6.1-darwin-arm64/python-env-tools/bin/pet" \
#    "$PYTHON_EXT/python-env-tools/bin/pet"
chmod +x "$PYTHON_EXT/python-env-tools/bin/pet"

mkdir -p "$ENVS_EXT/python-env-tools/bin"
ln -sf "$PYTHON_EXT/python-env-tools/bin/pet" "$ENVS_EXT/python-env-tools/bin/pet"

Note: Re-do this symlink after Python Environments or Python extension updates.

3. Cursor user settings

Add to ~/Library/Application Support/Cursor/User/settings.json:

{
  "python.defaultInterpreterPath": "/opt/homebrew/bin/python3",
  "python.useEnvironmentsExtension": true,
  "ansible.python.interpreterPath": "/opt/homebrew/bin/python3"
}

Do not put a repo-specific .venv path in global user settings — it applies to every workspace. With useEnvironmentsExtension enabled, Python Environments auto-selects .venv when present in the open project.

For repo-specific overrides, use .vscode/settings.json in that repo only.

4. Reload

Cmd+Shift+P → Developer: Reload Window

Expected result

  • No "Extension activation failed" for ms-python.python
  • No Ansible PET degraded warning
  • Terminal auto-activation of .venv in repos that have one
  • Ansible, Python, and Python Environments all remain installed

Extension versions (working set)

ms-python.python@2024.20.0          # pinned
ms-python.vscode-python-envs@1.10.0 # required by Ansible; do not remove
ms-python.vscode-pylance@2024.8.1   # latest Cursor allows
redhat.ansible@26.6.0

Debugging

Extension host log:

~/Library/Application Support/Cursor/logs/<latest>/window1/exthost/exthost.log

Python extension output:

~/Library/Application Support/Cursor/logs/<latest>/window1/exthost/ms-python.python/Python.log

Python Environments output:

~/Library/Application Support/Cursor/logs/<latest>/window1/exthost/ms-python.vscode-python-envs/Python Environments.log

Look for:

  • Extension activation failure: ms-python.python
  • [Ansible] PET binary check: ... — missing
  • [pet] Starting Python Locator ...

Unrelated noise (safe to ignore)

Message Cause
MCP spawn npx ENOENT Cursor cannot find npx in PATH when launched from Dock
GitLens Could not resolve hashgraph/infrastructure GitHub API / repo access, not extension activation

When this workaround can be removed

When Cursor upgrades its underlying VS Code base enough that:

  • ms-python.python 2025.6+ activates cleanly with ms-python.vscode-python-envs
  • OpenVSX or marketplace ships platform-specific python-envs builds with PET included

Until then, keep Python pinned at 2024.20.0.

References

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