Skip to content
Erik De Bonte edited this page Apr 8, 2024 · 9 revisions

Suggested fixes to common problems, garnered from the issues.

Packages are not found when using editable installs

If you want to use static analysis tools with an editable install, you should configure the editable install to use .pth files that contain file paths rather than executable lines (prefixed with import) that install import hooks.

For more details, see Pyright's editable install documentation.

Type "foo" cannot be assigned to type "bar"

Here's a bunch of example issues that might be similar to your bug (which may provide a resolution):

Pyright also has documentation on this specific error that might help.

How to switch Pylance builds

The first step in switching Pylance builds, regardless of which build you want, is to select Pylance in VS Code's Extensions pane:

image

This will show a tab containing details on the version that is currently installed: image

Switch from Release to Prerelease

To switch from Release to Prerelease, click the "Switch to Pre-Release Version" button: image

Switch from Prerelease to Release

Similarly, to switch from Prerelease to Release, click the "Switch to Release Version" button: image

Switch to a particular build

And to switch to a particular version (ex. to roll back to an earlier version), expand the "Uninstall" combo box and select "Install Another Version...". You will be presented with a list of Pylance versions to choose from: image