How to Fix pyright-lsp on Claude Code for Windows (The Complete Guide)
Source: Dev.to
Introduction
If you’ve tried to enable the pyright LSP plugin in Claude Code on Windows and hit a wall, this guide walks you through the three bugs that compound on Windows and provides a complete, tested fix.
Enable the Plugin
Add the following to ~/.claude/settings.json:
{
"enabledPlugins": {
"pyright-lsp@claude-plugins-official": true
}
}
Or install via the command palette:
/plugin install pyright-lsp@claude-plugins-official
If you see:
Plugin "pyright-lsp" not found in any marketplace
or later:
ENOENT: no such file or directory, uv_spawn 'pyright-langserver'
proceed to the next steps.
Register the Official Marketplace (Windows)
On macOS the official marketplace is pre‑registered; on Windows it isn’t. Add an extraKnownMarketplaces entry to your settings:
{
"extraKnownMarketplaces": {
"claude-plugins-official": {
"source": {
"source": "github",
"repo": "anthropics/claude-plugins-official"
}
}
},
"enabledPlugins": {
"pyright-lsp@claude-plugins-official": true
}
}
Now the command works:
/plugin install pyright-lsp@claude-plugins-official
Install a Real pyright-langserver Executable
The npm package creates pyright-langserver.cmd, a batch wrapper that libuv (used by Claude Code) cannot resolve on Windows. Install pyright via pip instead, which provides a native .exe:
pip install pyright
Verify the executable is on your PATH:
where pyright-langserver
Add the Scripts Directory to PATH (if needed)
Open PowerShell as Administrator and run:
$scripts = 'C:\Users\\AppData\Local\Programs\Python\Python311\Scripts'
$current = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine')
[System.Environment]::SetEnvironmentVariable('PATH', $current + ';' + $scripts, 'Machine')
Replace “ with your actual Windows username.
Final Configuration
Ensure your ~/.claude/settings.json contains both the marketplace registration and the plugin enablement:
{
"extraKnownMarketplaces": {
"claude-plugins-official": {
"source": {
"source": "github",
"repo": "anthropics/claude-plugins-official"
}
}
},
"enabledPlugins": {
"pyright-lsp@claude-plugins-official": true
}
}
Run the install command again (if you haven’t already):
/plugin install pyright-lsp@claude-plugins-official
Close Claude Code completely, then reopen it. Do not use /reload-plugins; a full restart is required.
Open any Python file. You should now see pyright diagnostics appear automatically, and features such as Go to Definition, Find References, etc., will work.
Why This Matters
With LSP enabled, Claude Code navigates your codebase semantically rather than relying on plain‑text search. It understands types, call hierarchies, and cross‑file references without loading entire files, which makes a massive difference for large projects.
Known Issues
These bugs are documented in the official issue tracker:
A future Claude Code release is expected to ship the official marketplace pre‑registered on Windows and provide a proper .exe for pyright-langserver.
Tested Environment
- Windows 11 Pro
- Claude Code 2.1.71 (native install)
- Python 3.11