Simple replacement for Python/Pylance - we really need a walkthrough
Is your feature request related to a problem? Please describe. Cursor does not offer a simple method to get Python interpreter + Pylance replacement working in the IDE. Tons of message board threads, posts, and issues are being ignored along with emails (mine, but presumably most others too).
Python symbols are no longer available and almost all hacks tend not to work; BasedPyright is hardly a replacement or remotely easy to configure.
Describe the solution you'd like A clear and simple document on what extensions to install and what configurations to use to get Python symbols, CTRL-click, and other basic functionality working in Cursor again.
Additional context Probably stop ignoring emails and customer service communications for one of your most requested features.
What OS are you using?
Those features are currently working on Macbook M2 Pro
Also Cursor Pyright extension but I think that is installed by default
This is a known problem they don't give a full answer to:
https://forum.cursor.com/t/pylance-breaks-on-cursor-0-38-1/6920
Cursor version:
If you install the Python extension, in VS Code the Pylance extension comes along for the ride. In Cursor latest, this doesn't happen, and on the default language server, you get this error, which you would expect since there is no Jedi language server installed:
If you download latest Pylance VSIX (2024.8.101 as of this post, updated 8/12/2024 per the VS code repo) and install it, you will get these errors:
Pylance blocks Cursor's ability to use it since it is a VS Code fork and not Microsoft's genuine software.
This is not really Cursor's fault, of course, and Microsoft earns some scorn here for not playing nice with forks (though they don't have to), but where blame lies with Cursor is the fact they don't address this in any sort of comprehensive manner with a walkthrough on alternatives for symbol resolution + command/control-click, type hinting/catching, etc - and instead relying instead on people suggesting BasedPyright (which is not feature complete and has plenty of problems itself).
Per #1634 I deleted the .cursor-server directory on my remote machine and that fixed a Git extension problem - I figured I would see if this did anything for Pylance issues.
Unsurprisingly, no:
If the Cursor Language Server can be used as a stand-in for Jedi/Pylance, I have no idea where that documentation would be or how to do that.
Full log of the licensing problem Cursor is facing:
2024-08-15 07:35:53.999 [info] Experiment 'pythonCreateEnvOnPipInstall' is active
2024-08-15 07:35:53.999 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-08-15 07:35:53.999 [info] Experiment 'pythonSurveyNotification' is active
2024-08-15 07:35:53.999 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-08-15 07:35:53.999 [info] Experiment 'pythonTestAdapter' is active
2024-08-15 07:35:54.577 [info] Test server listening.
2024-08-15 07:35:54.578 [info] Python interpreter path: /bin/python3
2024-08-15 07:35:55.121 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-08-15 07:35:55.122 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-08-15 07:35:55.762 [error] [
'Failed to start language server, Class name = h, completed in 854ms, has a falsy return value, Arg 1: <Uri:/home/mocap>, Arg 2:
{"id":"/bin/python3","sysPrefix":"/usr","envType":"Global","envName":"","envPath":"","path":"/bin/python3","architecture":3,"sysVersion":"3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0]","version":{"raw":"3.12.3","major":3,"minor":12,"patch":3,"build":[],"prerelease":["final","0"]},"displayName":"Python 3.12.3 64-bit","detailedDisplayName":"Python 3.12.3 64-bit"}, Arg 3: <argument cannot be serialized for logging>, Return Value: undefined',
[s [Error]: Request initialize failed with message: You may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the “Visual Studio Products and Services”) to develop and test your applications. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. You may not: work around any technical limitations in the software that only allow you to use it in certain ways; reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software, except and to the extent required by third party licensing terms governing use of certain open source components that may be included in the software; remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software; use the software in any way that is against the law or to create or propagate malware; or share, publish, distribute, or lease the software (except for any distributable code, subject to the terms above), provide the software as a stand-alone offering for others to use, or transfer the software or this agreement to any third party.
at /home/mocap/.cursor-server/extensions/ms-python.python-2023.14.0/out/client/extension.js:2:2310858
at re (/home/mocap/.cursor-server/extensions/ms-python.python-2023.14.0/out/client/extension.js:2:2311152)
at /home/mocap/.cursor-server/extensions/ms-python.python-2023.14.0/out/client/extension.js:2:2305936
at Immediate.<anonymous> (/home/mocap/.cursor-server/extensions/ms-python.python-2023.14.0/out/client/extension.js:2:2305956)
at process.processImmediate (node:internal/timers:478:21)] {
code: -32603,
data: undefined
}
More specifically, the plain English warning Microsoft is sending:
Request initialize failed with message: You may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the “Visual Studio Products and Services”) to develop and test your applications. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights.
You may not: work around any technical limitations in the software that only allow you to use it in certain ways; reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software, except and to the extent required by third party licensing terms governing use of certain open source components that may be included in the software; remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software; use the software in any way that is against the law or to create or propagate malware; or share, publish, distribute, or lease the software (except for any distributable code, subject to the terms above), provide the software as a stand-alone offering for others to use, or transfer the software or this agreement to any third party.
Best I can do is to install the newest Python (which you usually have to do manually via VSIX due to some random ZIP file errors you get in Cursor) and BasedPyright, then turn off the vast majority of the type hinting, if not entirely disable it as BasedPyright has insane recommendations.
This will bring back Outline symbols on the left-hand side; the combination of BasedPyright (even with type checking fully disabled in extension settings) and ms-python's Python extension bring back at least that much functionality.
Still not sure what Cursor Language Server does though and how to select Pyright-compatible language servers with the Python extension, since it just offers Jedi (which crashes) and Pylance (which obviously is not supported).
Here is a discussion that might help: https://github.com/VSCodium/vscodium/discussions/1641
On a clean install of cursor (by nuking .cursor-server on the remote host) and attempting to install the recommended Python extension named by Cursor on popping up a .py file, here are the errors/warnings I get (not all related to Python, but wanted to include it for completeness).
Should probably go without saying that Python extension is not installed.
2024-08-17 04:09:17.853 [info] Extension host agent started.
2024-08-17 04:09:17.871 [info] Started initializing default profile extensions in extensions installation folder. file:///home/mocap/.cursor-server/extensions
2024-08-17 04:09:17.924 [info] [127.0.0.1][ef7e8ded][ManagementConnection] New connection established.
2024-08-17 04:09:17.959 [info] Completed initializing default profile extensions in extensions installation folder. file:///home/mocap/.cursor-server/extensions
2024-08-17 04:09:17.976 [info] [127.0.0.1][69017caa][ExtensionHostConnection] New connection established.
2024-08-17 04:09:18.108 [info] [127.0.0.1][69017caa][ExtensionHostConnection] <6281> Launched Extension Host Process.
2024-08-17 04:09:24.143 [info] Getting Manifest... ms-python.python
2024-08-17 04:09:24.380 [info] Installing extension: ms-python.python {"isMachineScoped":false,"installOnlyNewlyAddedFromExtensionPack":true,"isApplicationScoped":false,"profileLocation":{"$mid":1,"fsPath":"/home/mocap/.cursor-server/extensions/extensions.json","external":"file:///home/mocap/.cursor-server/extensions/extensions.json","path":"/home/mocap/.cursor-server/extensions/extensions.json","scheme":"file"},"productVersion":{"version":"0.39.5","date":"2024-08-14T17:01:36.569Z","vscodeVersion":"1.91.1"}}
2024-08-17 04:09:25.038 [info] Getting Manifest... anysphere.pyright
2024-08-17 04:09:26.099 [info] Installing extension: anysphere.pyright {"isMachineScoped":false,"installOnlyNewlyAddedFromExtensionPack":true,"isApplicationScoped":false,"profileLocation":{"$mid":1,"fsPath":"/home/mocap/.cursor-server/extensions/extensions.json","external":"file:///home/mocap/.cursor-server/extensions/extensions.json","path":"/home/mocap/.cursor-server/extensions/extensions.json","scheme":"file"},"productVersion":{"version":"0.39.5","date":"2024-08-14T17:01:36.569Z","vscodeVersion":"1.91.1"},"context":{"dependecyOrPackExtensionInstall":true}}
2024-08-17 04:09:26.115 [info] Started downloading extension: ms-python.python 2023.14.0 file:///home/mocap/.cursor-server/data/CachedExtensionVSIXs/cursor-ms-python.python-2023.14.0-universal
2024-08-17 04:09:26.117 [info] Started downloading extension: anysphere.pyright 1.1.327 file:///home/mocap/.cursor-server/data/CachedExtensionVSIXs/cursor-anysphere.pyright-1.1.327-universal
2024-08-17 04:09:26.559 [warning] Failed downloading sigzip. End of central directory record signature not found. Either not a zip file, or file is truncated.. Retry again... ms-python.python
2024-08-17 04:09:26.678 [warning] Failed downloading sigzip. End of central directory record signature not found. Either not a zip file, or file is truncated.. Retry again... ms-python.python
2024-08-17 04:09:26.809 [error] Error while installing the extension ms-python.python End of central directory record signature not found. Either not a zip file, or file is truncated. file:///home/mocap/.cursor-server/extensions/extensions.json
2024-08-17 04:09:27.812 [error] Error: End of central directory record signature not found. Either not a zip file, or file is truncated.
at y (/home/mocap/.cursor-server/bin/274e2e5d572bd0b99449183635a0f94c7b9f54d0/out/vs/server/node/server.main.js:114:25872)
at /home/mocap/.cursor-server/bin/274e2e5d572bd0b99449183635a0f94c7b9f54d0/out/vs/server/node/server.main.js:114:27315
at /home/mocap/.cursor-server/bin/274e2e5d572bd0b99449183635a0f94c7b9f54d0/node_modules/yauzl/index.js:40:7
at /home/mocap/.cursor-server/bin/274e2e5d572bd0b99449183635a0f94c7b9f54d0/node_modules/yauzl/index.js:190:5
at /home/mocap/.cursor-server/bin/274e2e5d572bd0b99449183635a0f94c7b9f54d0/node_modules/yauzl/index.js:712:5
at /home/mocap/.cursor-server/bin/274e2e5d572bd0b99449183635a0f94c7b9f54d0/node_modules/yauzl/fd-slicer.js:33:7
at FSReqCallback.wrapper [as oncomplete] (node:fs:688:5)
2024-08-17 04:09:28.188 [error] Could not load vsce-sign module Cannot find module '@vscode/vsce-sign'
Require stack:
- /home/mocap/.cursor-server/bin/274e2e5d572bd0b99449183635a0f94c7b9f54d0/out/server-main.js
2024-08-17 04:09:28.188 [info] Extension signature verification is not done: anysphere.pyright
2024-08-17 04:09:32.163 [info] Extracted extension to file:///home/mocap/.cursor-server/extensions/anysphere.pyright-1.1.327-universal: anysphere.pyright
2024-08-17 04:09:32.239 [info] Renamed to /home/mocap/.cursor-server/extensions/anysphere.pyright-1.1.327-universal
2024-08-17 04:09:32.269 [info] Rollback: Uninstalled extension anysphere.pyright
2024-08-17 04:09:32.272 [info] Marked extension as uninstalled anysphere.pyright-1.1.327-universal
Here is a discussion that might help: VSCodium/vscodium#1641
I am aware of this workaround, but it no longer works.
It’s clear the Cursor team is either legally disallowed from talking about this issue or just don’t care about customer service anymore. Either way, I’ll be back when and if these things change. Rather sad to see.
@truell20
Same here. I only tried python and ruby, and neither of them works because of the language server issue.
Since Pylance is not working with cursor, that's a dealbreaker for me. I will also have to wait until this issue is resolved.
Too bad! Just downloaded Cursor, tried on TypeScript -> awesome so far But I can't work properly on my Python projects which is a deal break for me too :(
Keep up the great work and let us know when Python works :)
While Pylance remains broken, on the newest Cursor build and in a new server setup via remote-ssh, you get prompted to install the Python extension (ms-python) which installs version v2024.5.1. After restarting, I can confirm the Outline shows up and Python symbols have returned.
Still not enough - especially with no walkthrough on how Cursor Pyright even works - but this is a good step forward.
IF you nuke your ~/.cursor/extensions folder, create a new user on your mac, install Cursor fresh with no import from VSC, then open a .py file, it will install a version of Pylance that does work.
Then you can copy your ~/.cursor/extensions folder over to the old user and bingo... it now works.
@arkaydeus didn't help me. Can you share some details and insights, what is the difference between extensions? You can probably share your extensions.json file to see what versions are installed.
OK, I've made some progress on this.
Currently running MacOS. I installed a new profile (user) on my machine and strangely all worked fine. What I noticed though, is that different versions of the extensions are installed.
Compare the two. The darwin-arm64 versions work fine. The universal versions don't and keep running into issues. They're also older.
Following up and checking the two extensions.json files you can see the working version on the right and the broken version on the left.
On the right the targetPlatform is ‘darwin-arm64’ which is correct. On the left it’s ‘universal’ and then the version is 2024.5.1 and not 2024.12.3
This is incredibly frustrating. Same machine. Same OS. Just different user profile.
Would be really interested to see how I can force a particular architecture for extensions.
I cannot get python to work on Cursor. Seems like this issue has been there for a while. I'm a long time user of Cursor and I cannot believe that an extremely popular language like Python is broken.
Can this be fixed? Please tell us if not - I'll happily decamp for VSCode. @shaoruu @arvid220u
Having this issue too, please resolve.
Download to the oldest version, such as 2024.4.1 (Click the Gear button-> install another verison). If Pylance works, then update the versions one by one until 2024.12.2, or any other newer working version. do not attempting to skip any versions, as I have tried and failed before.
The issue persists on both versions.
cursor-0.41.3x86_64.AppImage
cursor-0.42.3-build-241016kxu9umuir-x86_64.AppImage
Only way I could get around this was to create a new user which allowed me to install the Arm64 version and not the universal ones. Couldn't figure out how to make Cursor install Arm64 by default.
Suspect you guys have the same issue, but migrating user did fix it.
@kyleboddy I was able to fix all of this by editing product.json. I've documented the steps in the following gist https://gist.github.com/joeblackwaslike/752b26ce92e3699084e1ecfc790f74b2
let me know if this works for you.
This has been working for me with the latest builds of Cursor out of the box, just noting that here. Didn't do anything special. Of course they can break at any time and the Cursor team isn't responding with any sort of official documentation.
I've been able to use pylance by disabling the cursor pyright extension
@kyleboddy I was able to fix all of this by editing product.json. I've documented the steps in the following gist https://gist.github.com/joeblackwaslike/752b26ce92e3699084e1ecfc790f74b2
let me know if this works for you.
That worked. But I am only able to use v2024.8 only, not the newest.
In my case, pylance works well after changing the color theme from VS Dark to Default Dark Modern.
This is the only reason why I haven't tried switching to Cursor from Vscode and I am confident there may plenty of others like me that won't touch Cursor until there is equivalent Python language support to Vscode — in fact I'd encourage anyone else who feels the same way to like this comment.
This isn't Cursor's fault nor necessarily Microsoft's, they are a for-profit company after all, but its simply the reality that until a suitable open-source or propretiary alternative to the closed-source Vscode-only Pylance extension comes along, it will difficult for many to switch to anything else.
Writing code without Pylance highlighting and intellisense feels (to me) like being forced to write in Notepad++.
@shaoruu @arvid220u Here are some other issues that are essentially the same as or are a direct consequence of this issue:
- https://github.com/getcursor/cursor/issues/945
- https://github.com/getcursor/cursor/issues/1205
- https://github.com/getcursor/cursor/issues/2662
- https://github.com/getcursor/cursor/issues/2664
- https://github.com/getcursor/cursor/issues/2194
And here are just a couple of the many forum posts about this:
- VSCode and Pylance Update Support Plans? by @PhenomenaPh
- Does Pylance just not work with Cursor? How to get imports in quick fix menu? by @zerk1
- Python syntax highlighting fails for some syntax by @yavid
- Python semantic highlighting not working by @TomoKanazawa
- Python Issues - lost my syntax highlighting by @bryangwin
- Is anyone else using Cursor with Python by @arkaydeus
- Basic syntax highlighting problem in the editor by @lukaemon
- Code highlightening bugs by @sirius777coder
- Critical Issues with Intellisense and Pyright in VS Code by @cevdet
The best 'solution' I could find is this workaround by @joeblackwaslike. Unfortunately, however, it requires you to modify your project.json every single time Cursor updates as described by @realdimas here.