getcursor / cursor

The AI-powered code editor
https://cursor.sh
20.58k stars 1.38k forks source link

Error running Interpreter Mode in WSL2: "No such file or directory" - CWD has wrong path separators #1383

Open JoshuaCWebDeveloper opened 3 months ago

JoshuaCWebDeveloper commented 3 months ago

Description

When running the chat in Interpreter Mode, every attempt by the interpreter to execute code in a Jupyter notebook fails with name 'ide' is not defined. This is caused by the first cell in the notebook throwing the following error before the IDE class can be defined:

[rd [Error]: [Errno 2] No such file or directory: '\\home\\<username>\\WebDev\\projects\\genai-node-red'
    at r.execute (~/.cursor-server/extensions/ms-toolsai.jupyter-2024.1.1-linux-x64/dist/extension.node.js:263:4968)] {
  ename: 'FileNotFoundError',
  evalue: "[Errno 2] No such file or directory: '\\\\home\\\\<username>\\\\WebDev\\\\projects\\\\genai-node-red'",
  traceback: [
   ---------------------------------------------------------------------------
    FileNotFoundError                         Traceback (most recent call last)
    Cell In[1], line 5
          2 import os
          3 import base64
    ----> 5 os.chdir(base64.b64decode("XGhvbWVcam9zaHVhXFdlYkRldlxwcm9qZWN0c1xnZW5haS1ub2RlLXJlZA==").decode("utf-8"))
          7 CURSOR_IDE_ACTION_IDENTIFIER = "cursor-unique-ide-action-identifier-31972ee0d628"
          9 class IDE:

    FileNotFoundError: [Errno 2] No such file or directory: '\\home\\<username>\\WebDev\\projects\\genai-node-red'
  ]
}

The base64-encoded string decodes to: \\home\\joshua\\WebDev\\projects\\genai-node-red, so I believe the <username> is showing up in the error as some sort of obfuscation, and that the error is actually caused by a Windows path separator being used for a Unix path:

$ ls -la \\home\\joshua\\WebDev\\projects\\genai-node-red
ls: cannot access '\home\joshua\WebDev\projects\genai-node-red': No such file or directory
$ ls -la /home/joshua/WebDev/projects/genai-node-red
total 584
drwxr-xr-x   7 joshua joshua   4096 Apr  5 13:03 .
drwxr-xr-x  10 joshua joshua   4096 Mar 30 18:23 ..
-rw-r--r--   1 joshua joshua      8 Apr  5 12:56 .autoenv

Additional Details

1) If you can, please include a screenshot of your problem image image

2) Please include the name of your operating system

OS Name Microsoft Windows 11 Pro
Version 10.0.22631 Build 22631
Linux XXXXX-XXXXXX 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal

3) If you can, steps to reproduce are super helpful Run interpreter mode in an WSL Ubuntu window with an open folder on the Ubuntu filesystem.

Here is the full Jupyter output leading up to the error:

Cursor (1.86.2, wsl, desktop)
Jupyter Extension Version: 2024.1.1.
Python Extension Version: 2023.22.1.
Pylance Extension Version: 2023.10.40.
Platform: linux (x64).
Workspace folder ~/WebDev/projects/genai-node-red, Home = /home/joshua
21:30:01.978 [info] Start refreshing Kernel Picker (1712377801978)
21:30:01.984 [info] Using Pylance
21:30:04.701 [info] End refreshing Kernel Picker (1712377801978)
21:30:04.999 [warn] Failed to get activated env vars for /bin/python3 in 2653ms
21:30:05.097 [info] Process Execution: /bin/python3 -c "import site;print("USER_BASE_VALUE");print(site.USER_BASE);print("USER_BASE_VALUE");"
21:30:05.266 [error] Unable to determine site packages path for python /bin/python3 (Unknown)
21:30:05.278 [info] Process Execution: /bin/python3 -m pip list
21:30:18.212 [info] Start refreshing Interpreter Kernel Picker
21:30:18.213 [info] Start refreshing Kernel Picker (1712377818213)
21:30:18.220 [info] Handle Execution of Cells 0 for c:/Users/carte/.cursor/interpreter-notebooks/2024-04-06T04_30_11.733Z-ca0eb70a-1e6e-4511-8259-19bfa7053f2d.ipynb
21:30:18.246 [info] No interpreter for Pylance for Notebook URI "c:/Users/carte/.cursor/interpreter-notebooks/2024-04-06T04_30_11.733Z-ca0eb70a-1e6e-4511-8259-19bfa7053f2d.ipynb"
21:30:18.254 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd01729b6f5c23daf481ab834d213193231d0f22e0d3f353978793e345c870bb843.~/anaconda3/envs/athena/python.~/anaconda3/envs/athena/python.-m#ipykernel_launcher  (Python Path: ~/anaconda3/envs/athena/bin/python, Conda, athena, 3.8.19) for 'c:/Users/carte/.cursor/interpreter-notebooks/2024-04-06T04_30_11.733Z-ca0eb70a-1e6e-4511-8259-19bfa7053f2d.ipynb' (disableUI=false)
21:30:19.830 [info] Process Execution: ~/anaconda3/envs/athena/bin/python -m pip list
21:30:19.831 [info] End refreshing Kernel Picker (1712377818213)
21:30:19.878 [info] Process Execution: ~/anaconda3/envs/athena/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
21:30:19.892 [info] Process Execution: ~/anaconda3/envs/athena/bin/python -m ipykernel_launcher --f=~/.local/share/jupyter/runtime/kernel-v2-583WoqxzMa1Trzy.json
    > cwd: ~/WebDev/projects/genai-node-red
21:30:19.892 [info] Kernel process 1942.
21:30:20.909 [info] Registering Kernel Completion Provider from kernel athena (Python 3.8.19) for language python
21:30:20.925 [info] Kernel acknowledged execution of cell 0 @ 1712377820925
21:30:21.091 [warn] Cell completed with errors [rd [Error]: [Errno 2] No such file or directory: