Venv often not triggered

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Agents needing to run the app being developed frequently generate shell commands that don’t activate the venv programmatically known to the procedural environment and which also SHOULD be known to the AI environment, given the AIs have noticed many times previously the venv had to be activated to correct errors in the commands. This results in many unecessary tool use turns in the agentic flow, as python invocations fail and are then retried with the venv. Cases where the agent has to correct itself should probably be mined for memories to improve future runouts.

Steps to Reproduce

see description

Expected Behavior

venv, especially when known to the procedural environment, should be consistently applied to python invocations in the project.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.3.34 (Universal)
VSCode Version: 1.105.1
Commit: 643ba67cd252e2888e296dd0cf34a0c5d7625b90
Date: 2026-01-10T21:17:10.428Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 24.6.0

For AI issues: which model did you use?

Sonnet 4.5

Does this stop you from using Cursor

No - Cursor works, but with this issue

… the same is true of other errors related to how to invoke the very program being debugged, like not redirecting stderr to the output file being captured for log analysis and having to repeat the command generation several times per debugging run …

Hey, thanks for the report. This is a known issue, a regression after the Cursor 2.0 release. The agent terminal is currently ignoring the python.terminal.activateEnvironment: true setting and won’t auto-activate the venv.

The team is working on a fix. For now, here are a few workarounds:

If you’re using uv, try explicitly adding this to .cursorrules or AGENTS.md:

When running Python code, use: uv run your_script.py
Don't use: source .venv/bin/activate && python your_script.py (doesn't work in agent terminal)

If you’re not using uv, you can add this to your rules:

Always use the full path to the Python interpreter: .venv/bin/python your_script.py

Similar discussion here: Correct Python interpreter - how hard can it be?

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.