My virtual environment is buggy when i create a terminal inside cursor. e.g. the dependencies are not recognized. Pleas
On the image on the left is my cursor ide with the terminal. Even though I am in the virtual environment named ‘golf’, I can’t see my opencv installed. On the right, I have opened regular terminal and I can see opencv in my virtual env.
this issue typically occurs when Cursor’s terminal isn’t properly loading the virtual environment’s path. to troubleshoot:
- run these commands in both Cursor’s terminal and a regular terminal:
which python
echo $VIRTUAL_ENV
echo $PATH
- compare the outputs to verify if Cursor is using the correct python interpreter and environment paths.
The first two commands which python
and echo $VIRTUAL_ENV
have the same output in cursor vs regular terminal. The output of echo $PATH
is different; cursor’s terminal has additional directory: /home/user/.cursor/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/zsh
.
The only solution that has worked for me is if I deactivate the environment (for each cursor terminal) and then reactivate again by sourcing the activate
file in the virtual environment. Also, executing deactivate
in cursor prints a warning message
grep: /home/user/.cursor/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/zsh/envVars.txt: No such file or directory
grep: /home/user/.cursor/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/zsh/envVars.txt: No such file or directory
grep: /home/user/.cursor/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/zsh/envVars.txt: No such file or directory
Also, once I manually activate, the additional directory in $PATH no longer exists
I’m also running into this issue
Same issue. The integrated terminal is not usable, I have been dealing with this issue for months now.
Happening to me too.
which python, $PATH, $PYTHONHOME and all other commands seems to be identical but inside python we can see that the interpreter is not the one there.
(venv) ➜ app git:(main) ✗ python
Python 3.11.9 (main, Jan 27 2025, 10:02:36) [GCC 11.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import sys
print(“Using Python interpreter:”, sys.executable)
Using Python interpreter: /home/andre/app/cursor-0.45.11-build-250207y6nbaw5qc-x86_64.AppImage