Skip to content

Instantly share code, notes, and snippets.

@joeblackwaslike
Last active July 5, 2025 12:39
Show Gist options
  • Save joeblackwaslike/752b26ce92e3699084e1ecfc790f74b2 to your computer and use it in GitHub Desktop.
Save joeblackwaslike/752b26ce92e3699084e1ecfc790f74b2 to your computer and use it in GitHub Desktop.
How to use python with the Cursor IDE

How to use python with the Cursor AI IDE

We are going to edit cursors settings to point to the microsoft extensions marketplace.

  1. Remove all extensions and exit Cursor.
  2. Locate your Cursor project.json file depending on your platform and open it.
    • On MacOS: /Applications/Cursor.app/Contents/Resources/app/product.json
    • On Windows: C:\Users\<user_name>\AppData\Local\Programs\cursor\resources\app\product.json
    • On Linux: /usr/lib/code/product.json
  3. Locate the object value for key extensionsGallery in the json document.

Contents of extensionsGallery key in product.json for Cursor

{
    "galleryId": "cursor",
    "serviceUrl": "https://marketplace.cursorapi.com/_apis/public/gallery",
    "itemUrl": "https://marketplace.cursorapi.com/items",
    "resourceUrlTemplate": "https://marketplace.cursorapi.com/{publisher}/{name}/{version}/{path}",
    "controlUrl": "",
    "recommendationsUrl": "",
    "nlsBaseUrl": "",
    "publisherUrl": ""
}
  1. Edit it to look like this:
{
    "galleryId": "cursor",
    "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
    "itemUrl": "https://marketplace.visualstudio.com/items",
    "resourceUrlTemplate": "https://{publisher}.vscode-unpkg.net/{publisher}/{name}/{version}/{path}",
    "controlUrl": "",
    "recommendationsUrl": "",
    "nlsBaseUrl": "",
    "publisherUrl": ""
}
  1. Reopen Cursor.app and install the following extensions:
    • ms-python.python
    • ms-python.vscode-pylance
    • ms-python.debugpy
  2. Make sure in your settings that python.languageServer is set to "Pylance"
  3. Re-sign Cursor.app (for MacOS)
codesign --force --deep --sign - /Applications/Cursor.app

Enjoy!

PS: you may need to goto your settings.json to remove any theme settings, because having a broken theme looks exactly like this same problem. In my case cursor had copied over my settings from vscode and they pointed to a theme that wasn't yet installed in cursor, removing and then setting the theme manually worked when I though for sure I had broken it again.

@realdimas
Copy link

@gemnioo 198.41.30.195 is eclipse.dev – doesn't seems relevant to the issues discussed in this gist:

$ host 198.41.30.195
195.30.41.198.in-addr.arpa domain name pointer eclipse.dev.

@gemnioo
Copy link

gemnioo commented May 9, 2025

@gemnioo 198.41.30.195 is eclipse.dev – doesn't seems relevant to the issues discussed in this gist:

$ host 198.41.30.195
195.30.41.198.in-addr.arpa domain name pointer eclipse.dev.

double checked Gemini not hallucinations

This error repeats multiple times throughout the logs.

    ECONNREFUSED: This is a standard network error code meaning the connection was actively refused by the server at the specified address and port. The server received the connection attempt but declined it.

    198.41.30.195: This is an IP address associated with Microsoft services, specifically related to the Visual Studio Marketplace (where VS Code/code-server fetches extensions from).

    443: This is the standard port for HTTPS (secure web traffic).

@realdimas
Copy link

2025.4.100 is the most recent Pylance extension that is compatible with the current Cursor (tested with 0.50 versions).
The extension can be installed by dragging and dropping the .vsix file into the Extensions tab in Cursor.

Direct download link to the .vsix extension package:
https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2025.4.100/vspackage

@Asap7772
Copy link

Thank you!

@charlie632
Copy link

I was able to install Pylance before, but somehow I broke my Cursor, so I had to do a clean installation, and none of the solutions are now working. I keep seeing the (Client) You may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code log on the Python Language Server output.

Has anyone found a new solution for this?

@canersnli
Copy link

I didn't see this warning but solutions mentioned above didn't work until I downgraded the cursor to 1.0

@realdimas
Copy link

Cursor just released v1.2.0 – a big upgrade to the upstream VSCode version used under the hood (v1.96.2 -> v1.99.3).
This is a welcome and long-awaited upgrade that improves support for newer extensions.

On the other hand, it breaks out-of-the-box support with Pylance 2025.4.1 (and 2025.4.100) builds.
These versions now (rightfully) detect that this isn't vanilla VSCode and bark with "You may install and use any number of copies of the software only with Microsoft Visual Studio...".

One way to address this issue is to simply downgrade to the most recent Cursor build that is still using VSCode v1.96.2, that is Cursor v1.1.7.
See unofficial links to the older Cursor builds at https://github.com/oslook/cursor-ai-downloads?tab=readme-ov-file#all-versions-download-table

Another way is to dial up the effort and start patching obfuscated Pylance code to coerce it into running on Cursor.

Earlier this year @caenrigen had shared a patch to Pylance v2025.4.1 that makes it work with VSCode forks (Cursor, Windsurf, etc.): VSCodium/vscodium#1641 (comment)

To recap:

  1. Download Pylance v2025.4.1 .vsix file.
  2. Unpack into a temporary folder
  3. Edit extension/dist/extension.bundle.js
  4. Remove the following string from the file:
    return(0x0,_0x302dc7[_0x1e5d1c(0x69a)])(_0x17bc9b[_0x1e5d1c(0x120)]),{'client':_0x5d8ccf,'start':()=>{const _0x751a33=_0x1e5d1c;return _0x2bfc9a['sendTelemetryEvent'](_0x1d90e3['EventName'][_0x751a33(0x48e)]),Promise[_0x751a33(0x60e)]();},'stop':()=>Promise[_0x1e5d1c(0x60e)](),'disposables':_0x22650a};
    
  5. Zip it back into a .vsix
  6. Install some other version of Pylance .vsix by drag-and-dropping it into the Extensions tab to "bust the cache" (skipping this might prevent the IDE from noticing patched content of the same-versioned extension)

Handy shell script (tested on macOS):

# Download Pylance v2025.4.1 (platform-independent)
wget https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/vscode-pylance/2025.4.1/vspackage -O ms-python.vscode-pylance-2025.4.1.vsix

# Ungzip (not sure why it's gzipped on top of a zip, but that's what the server is returning regardless of the Accept-Encoding header value)
gunzip -c ms-python.vscode-pylance-2025.4.1.vsix > ms-python.vscode-pylance-2025.4.1.zip

# Unzip it into a folder
unzip -d ms-python.vscode-pylance-2025.4.1-patched ms-python.vscode-pylance-2025.4.1.zip

# Define the literal value to remove using a here-document
literal=$(cat <<'EOF'
return(0x0,_0x302dc7[_0x1e5d1c(0x69a)])(_0x17bc9b[_0x1e5d1c(0x120)]),{'client':_0x5d8ccf,'start':()=>{const _0x751a33=_0x1e5d1c;return _0x2bfc9a['sendTelemetryEvent'](_0x1d90e3['EventName'][_0x751a33(0x48e)]),Promise[_0x751a33(0x60e)]();},'stop':()=>Promise[_0x1e5d1c(0x60e)](),'disposables':_0x22650a};
EOF
)

# Calculate the length of the literal
length=${#literal}

# Create a replacement string of the same length (spaces)
replacement=$(printf '%*s' $length '')

# Replace the literal with spaces to preserve length with perl
perl -i -pe "s/\Q$literal\E/$replacement/g" ms-python.vscode-pylance-2025.4.1-patched/extension/dist/extension.bundle.js

# Package it back into a .vsix
(cd ms-python.vscode-pylance-2025.4.1-patched && zip -r ../ms-python.vscode-pylance-2025.4.1-patched.vsix .)

@qiangxinglin
Copy link

As of 2025/7/2, after upgrading Cursor to v1.2.0, the marketplace patch is not working anymore. Now I cannot search any extensions after patch the product.json.

@PhenomenaPh
Copy link

I guess we can change now a marketplace via vscode settings

image

@realdimas
Copy link

Custom extension gallery URLs can be set as of Cursor 1.1.3 (much like Windsurf).

https://forum.cursor.com/t/dbt-extension-not-visible-in-marketplace/107089/9

{
    // <...>
    "extensions.gallery.itemUrl": "https://marketplace.visualstudio.com/items",
    "extensions.gallery.serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
    // <...>
}

Unfortunately, this hasn't been working in 1.2.0 (or 1.2.1):

For some strange reason, the extensions.gallery.itemUrl key is dimmed in the User Settings JSON, i.e., it seems to be unused (unlike in versions 1.1.3+ before the 1.2.0 release).

Setting both keys (and restarting Cursor) results in:

  • Extension gallery searches spin forever and return no results

Updating gallery keys in product.json results in:

  • Extension gallery searches return no results

It seems that the ability to point to a custom extension gallery has been broken since version 1.2.0.

@Ilyas-Malik
Copy link

Amazing @realdimas, your extension repackaging worked for me, no need to roll cursor back
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment