Discovering Python Interpreters stucks forever

This happens at random moments:

Version: 0.39.6
VSCode Version: 1.91.1
Commit: a4f99b7dfb14460cb0bcebd9f6ac7ca158217920
Date: 2024-08-19T00:03:08.275Z
Electron: 29.4.0
ElectronBuildId: undefined
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin x64 23.5.0

3 Likes

Just in case it speeds up the process of troubleshooting, you might want to paste system info from:

Cursor > Help > About.

And a few more troubleshooting questions:

Are you using Interpreter Mode in Ctrl + L when you see this message?

Do you have Python installed on your system?

If so, which version?

Do you have these extensions from Microsoft installed?

  • Python from ms-python
  • Jupyter from ms-toolsai

I had quite a bit of trouble getting Interpreter Mode to work when I first started using Cursor, so Iā€™m aware it requires you to be really clear about what Python version you have installed, and whether you have the required extensions installed and configured properly etc.

Updated system info in first message.

Yes, I have both extensions:

  • Python from ms-python
  • Jupyter from ms-toolsai

I have multiple versions of python installed on my system (python3.12 from python org and few from homebrew)

UPD: I disabled * Jupyter from ms-toolsai, Pylance, Python Debugger and Jupyter extensions end issue is kinda gone

This is happening for me as well. Disabling pylance/ms-python extensions fixes it, but thatā€™s not really a solution.

An excessive solution that may work is ā€˜resetting cursor stateā€™. The downside is it would clear your local chat history.

Steps are:

  1. Quit Cursor
  2. rm -r ~/.cursor/extensions/*
  3. rm -rf ~/Library/Application\ Support/Cursor/
  4. Open up Cursor and go through onboarding again/install relevant extensions

I would try skipping step 3 the first time you try this and see if that works before clearing all local state.

Fresh install, did all the steps you provided. Still stuck with a ā€œDiscovering Python Interpretersā€

Version: 0.40.4

VSCode Version: 1.91.1

Commit: 63dae81aea2c3fc079420fe72578a8eef26ba870

Date: 2024-09-05T02:52:05.660Z (5 days ago)

Electron: 29.4.0

ElectronBuildId: undefined

Chromium: 122.0.6261.156

Node.js: 20.9.0

V8: 12.2.281.27-electron.0

OS: Darwin arm64 23.5.0

Also struggling with this and finding myself go back to VSCode so that i can jump to definition and get the amazing syntax highlighting iā€™m used to from Pylance.

I use direnv for managing python environments and that all works perfectly fine in VSCode.

ersion: 0.40.4
VSCode Version: 1.91.1
Commit: 63dae81aea2c3fc079420fe72578a8eef26ba870
Date: 2024-09-05T02:52:05.660Z (1 wk ago)
Electron: 29.4.0
ElectronBuildId: undefined
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.2.0

I was having problems with the interpreters doing being discovered. All I had to do was to switch the jupyter (ms-toolsai) to pre-release and then it was able to find my interpreters.

So I was having this issue on one user on my machine and not another. Turned out that cursor was installing the universal versions of the python extensions in the broken profile and the darwin-arm64 versions in the one that works fine.

Still trying to identify how you can force darwin-arm64 versions.

Check your ~/.cursor/extensions folder. If you have the universal version of Python and not the darwin-arm64 version, this is probably what is causing the problem.

Im still having this issue on an M1 chip after going through all of the above. Im surprised there arenā€™t more people experiencing this.

1 Like

Same Problem here. In VS Code it is working, but not in Cursor.

Version: 0.41.3
VSCode Version: 1.91.1
Commit: 51c8aff7cb5a89f4a0e462fbacab938bdbfaf140
Date: 2024-09-25T17:13:50.377Z
Electron: 29.4.0
ElectronBuildId: undefined
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 24.0.0

1 Like

I just took another stab at resolving this and it seems to have worked:

I saw a lot of old python versions in my ~/.pyenv, so i went and deleted everything older than 3.11 and now itā€™s all working nicely and no longer stuck on ā€œDiscovering Python interpretersā€

I never directly use these pyenv versions in Cursor/VSCode (i always use a venv or direnv), so was surprised this worked, but it did!

1 Like

That worked for me too! :heart_eyes: :heart_eyes:

I also got hit by this and had to take a couple of additional steps to get this sorted. This is on an M1 Mac.

Started with fresh install, with extensions set up from scratch. Then ā€œDiscovering Python Interpretersā€ got stuck as soon as I installed the Python extension.

I had a few different Python versions installed via homebrew and pyenv but after reading the thread removed everything apart from the ones actually in use: 3.11 (installed via pyenv) and 3.12 (installed via homebrew).

This didnā€™t solve the issue.

I also had a number of virtual environments set up via pipenv, and I knew that some of these would be linked to old (now uninstalled) versions of Python. So I deleted any dead symlinks by running

find ~/.local/share/virtualenvs -type l -name "python" ! -exec test -e {} \; -exec rm {} \;

This last part got the ā€œDiscovering Python Interpretersā€ process to finally run successfully.

A couple of notes:

  • you can replace -exec rm {} \; with -print to simply show the dangling symlinks
  • if youā€™re feeling braver you can also replace it with -exec with -execdir sh -c 'rm -rf "$(dirname "$(pwd)")"' \; in order to delete each of the outdated virtualenvs entirely, not just the dangling python symlinks
  • doing this kind of cleanup was fine in my case since I use pipenv and the contents of each virtual environment are defined elsewhere, meaning I could easily recreate any that Iā€™m actually using. But anyone who has hand-crafted environments should obviously proceed with caution
1 Like

Thank you. This helped. The loop ended after I deleted some old ~/.local/share/virtualenvs and restarting Cursor.