[Linux] Cannot use python scripts both in cursor IDE and Cursor Terminal : working command in system terminal does not work in cursor terminal, executable "sys.executable: /opt/cursor.appimage" replaces selected Python executable and blocks module imports
I installed "lorem_text" python dependency
When I run a script using it, even when specifying the full path to my virtual env, cursor replaces the executable
If I print "sys.executable" it returns "/opt/cursor.appimage"
This is even with the executable correctly set in Cursor IDE, and all linters detecting the requirement
Step to reproduce on Linux :
- Create virtual env
- Install any dependency, example lorem_text
- Run a script from terminal or from "play" button on top right of IDE using that dependency
- The installed modules is not detected, script cannot run
Reproduction script :
import sys
print(f"sys.executable: {sys.executable}")
from lorem_text import lorem
❯ which python
/home/me/dev/PythonKit/.venv/bin/python
❯ which pip
/home/me/dev/PythonKit/.venv/bin/pip
❯ pip install lorem_text
Requirement already satisfied: lorem_text in ./.venv/lib/python3.11/site-packages (2.1)
Requirement already satisfied: Click>=7.0 in ./.venv/lib/python3.11/site-packages (from lorem_text) (8.1.7)
❯ /home/me/dev/PythonKit/.venv/bin/python /home/me/dev/PythonKit/app/scripts/contrib.py
sys.executable: /opt/cursor.appimage
Traceback (most recent call last):
File "/home/me/dev/PythonKit/app/scripts/contrib.py", line 12, in <module>
from lorem_text import lorem
ModuleNotFoundError: No module named 'lorem_text'
Operating System: TUXEDO OS 2 KDE Plasma Version: 5.27.10 KDE Frameworks Version: 5.114.0 Qt Version: 5.15.12 Kernel Version: 6.5.0-10040-tuxedo (64-bit) Graphics Platform: X11
The same command
/home/me/dev/PythonKit/.venv/bin/python /home/me/dev/PythonKit/app/scripts/contrib.py
Work in system terminal but not in cursor IDE terminal, which is SUPER abnormal
This is really blocking my workflow with Python on Cursor ATM
I'm having the same problem, did you solve this?
How can such a serious issue not be answered or fixed for 10 months?
Maybe we can try debugging it together? Are you using a new project or importing an existing one (I've been using mine in VScode)? I'm running ubuntu here
are you using zsh in the cursor terminal?
yes!
changing to bash seems to solve the issue, right??
Yep. I found like ~50 similar issues in this forum. all seem to be related to zsh. using bash solves all of them.
For others searching here, this solves:
- python -m venv venv not working
- python symlink to AppIMage problem
- python module not found problem
- active virtual env but python path is not correct
Thanks! :)
On Fri, Oct 18, 2024 at 11:05 AM johbub @.***> wrote:
Yep. I found like ~50 similar issues in this forum. all seem to be related to zsh. using bash solves all of them.
For others searching here, this solves:
- python -m venv venv not working
- python symlink to AppIMage problem
- python module not found problem
- active virtual env but python path is not correct
— Reply to this email directly, view it on GitHub https://github.com/getcursor/cursor/issues/1484#issuecomment-2422556912, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOECTQMZMVCBOVC6PKPZLZ4EIQ7AVCNFSM6AAAAABJAAFTBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRSGU2TMOJRGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Martin Sarsale http://www.linkedin.com/in/msarsale
I am also experiencing this issue and can confirm that switching from zsh to bash resolves the issue. It'd be nice to get back to using zsh, though, this is a frustrating thing to debug for an IDE.
By chance of debugging some code, I discovered that this alias solves the problem for me: alias python='/usr/bin/env python'. Something is broken in Cursor that this is not properly done, I think.
#792 Same issue here. Over a year with no resolution. Using zsh with cursor is impossible with this bug
This is blocking me from switching from vscode to cursor.
This workaround works for me: import sys sys.path.append(f"venv/lib/python{sys.version_info.major}.{sys.version_info.minor}/site-packages")
The lines need to be run before you import anything that is in site-packages.
Another way to walk around: use the remote ssh plugin to open your localhost folder in ssh, similar to how you are attaching cursor/vscode to a remote server (first make sure your ssh service is activated, can be checked by ssh localhost). In this case, you are only using a Cursor frontend and the cursor-server backend. zsh works well in this case
moving to bash worked for me, dont waste your time
It seems that the issue lies in the interaction between zsh and Cursor. I set the defaultProfile to tmux in the settings ( "terminal.integrated.defaultProfile.linux": "tmux") to isolate zsh, and it works fine now with zsh.
It seems that the issue lies in the interaction between zsh and Cursor. I set the defaultProfile to tmux in the settings (
"terminal.integrated.defaultProfile.linux": "tmux") to isolate zsh, and it works fine now with zsh.
works !
It seems that the issue lies in the interaction between zsh and Cursor. I set the defaultProfile to tmux in the settings (
"terminal.integrated.defaultProfile.linux": "tmux") to isolate zsh, and it works fine now with zsh.
For anyone struggling to know where to insert this setting and being confused by an existing VS Code installation: it should go in the ~/.config/Cursor/User/settings.json file, not in ~/.config/Code/User/settings.json. This is logical, however, it confused me a lot because whenever I would quick search for settings.json, the latter would pop up (for whatever reason).
I managed to solve this issue by extracting the .AppImage file and running the application from the extracted files.
Started encountering the issue after trying to run TheAssassin/AppImageLauncher on my system which didn't work as I'm using Linux version that it does not support, or at least has problems with (using Linux Mint 21.3 Cinnamon).
How to fix:
- Download AppImage for Cursor.
- Run:
./cursor.AppImage --appimage-extract cd squashfs-root ./AppRun
Now Python displays the correct sys.executable after application launch.
Used Cursor 0.46.9 and zsh as shell, do not have terminal.integrated.defaultProfile.linux set in Cursor config.
https://github.com/user-attachments/assets/b7cc84ca-3dc1-4867-a705-4700a1607157
@eioo This works, thanks! If you want to run the extracted AppRun from the launcher, do the following:
sudo cp -r /squashfs-root /opt/Cursor
sudo cp /opt/Cursor/cursor.desktop /usr/share/applications
then edit /usr/share/applications/cursor.deskop and overwrite it with the following
[Desktop Entry]
Name=Cursor
Comment=The AI Code Editor.
GenericName=Text Editor
Exec=/opt/Cursor/AppRun %F
Icon=/opt/Cursor/co.anysphere.cursor.png
Type=Application
StartupNotify=false
StartupWMClass=Cursor
Categories=TextEditor;Development;IDE;
MimeType=application/x-cursor-workspace;
Actions=new-empty-window;
Keywords=cursor;
X-AppImage-Version=0.46.9-3395357a4ee2975d5d03595e7607ee84e3db0f2c.deb.glibc2.25
[Desktop Action new-empty-window]
Name=New Empty Window
Exec=/opt/Cursor/AppRun --new-window %F
Icon=/opt/Cursor/co.anysphere.cursor.png
I managed to solve this issue by extracting the
.AppImagefile and running the application from the extracted files.Started encountering the issue after trying to run TheAssassin/AppImageLauncher on my system which didn't work as I'm using Linux version that it does not support, or at least has problems with (using Linux Mint 21.3 Cinnamon).
How to fix:
- Download AppImage for Cursor.
- Run: ./cursor.AppImage --appimage-extract cd squashfs-root ./AppRun
Now Python displays the correct
sys.executableafter application launch.Used Cursor 0.46.9 and
zshas shell, do not haveterminal.integrated.defaultProfile.linuxset in Cursor config.2025-03-06_07-13-20.mp4
@eioo This works, thanks! If you want to run the extracted
AppRunfrom the launcher, do the following:sudo cp -r /squashfs-root /opt/Cursor sudo cp /opt/Cursor/cursor.desktop /usr/share/applicationsthen edit
/usr/share/applications/cursor.deskopand overwrite it with the following[Desktop Entry] Name=Cursor Comment=The AI Code Editor. GenericName=Text Editor Exec=/opt/Cursor/AppRun %F Icon=/opt/Cursor/co.anysphere.cursor.png Type=Application StartupNotify=false StartupWMClass=Cursor Categories=TextEditor;Development;IDE; MimeType=application/x-cursor-workspace; Actions=new-empty-window; Keywords=cursor; X-AppImage-Version=0.46.9-3395357a4ee2975d5d03595e7607ee84e3db0f2c.deb.glibc2.25 [Desktop Action new-empty-window] Name=New Empty Window Exec=/opt/Cursor/AppRun --new-window %F Icon=/opt/Cursor/co.anysphere.cursor.png
Works like a charm! Thanks!
I've just updated to Cursor 0.49 and this is still happening. It seems that ZSH is not supported.
On fedora, using zsh, same sort of issue.
I found there were some junk configs getting injected by cursor at ls -la ~/.local/lib/python*/site-packages/ | grep -i <my weird search term> -- after clearing that out it worked as expected.
I use uv primarily and have a fixed folder to manage virtual environments, so it was a bit easier to diagnose. But somewhere in sys path this is getting injected by cursor. Yuck.
Problem is still there...
From my experience, I'd say it's already resolved for a month or two.