Pylance requires a latest version of VS Code.
If you open the integrated terminal, go to the Output tab and select Python Language Server from the dropdown, you might see an error message similar to "The language client requires VS Code version ^1.51.0 but received version 1.50.1" If so, updating VS Code to the latest version might resolve the issue.
Answer from Pelle Jacobs on Stack OverflowPylance requires a latest version of VS Code.
If you open the integrated terminal, go to the Output tab and select Python Language Server from the dropdown, you might see an error message similar to "The language client requires VS Code version ^1.51.0 but received version 1.50.1" If so, updating VS Code to the latest version might resolve the issue.
Adding the following in the settings.json file fixed it for me.
"python.analysis.exclude": ["**"]
Pylance is not working on my vscode
Help! After update I think my Pylance stopped working. Things are not highlighting.
Pylance is not work for jupyter notebook in VScode
Pylance not detecting python in visual studio code - Development - NixOS Discourse
Videos
Anyone know how can we fix this issue if we build the vscode locally
Please help!
Not so much of a Python problem as a Python development environment problem.. Pylance is unable to see an installed package, which is a package I have created and installed, whereas Jedi can.
The package in question is one that I have created myself, and it was installed into a virtual environment using pip install.
Python is able to run code from the package.
Things I have tried:
- Deleting all extensions from .~/vscode/extensions/
- Uninstalling/reinstalling VSCode
While I am currently able to use Jedi in place of Pylance ( although its missing syntax highlighting) I am concerned that this is indicative of a larger issue which will bite me in the ass if left unchecked.Any help would be great as I have deadlines approaching which depend on me being able to use my Python developing environment. Thanking you in advance.
Have posted in r/learnpython as well.
UPDATE: I am installing the package in question with 'pip install -e', however if i properly install the package with 'pip install', pylance plays nicely. This made me think that it was a workspace problem, so I moved the source code dir into the workspace and tried 'pip install -e' again, but no luck.
If you ensure that you have set python language server like below:
{
"python.languageServer": "Pylance"
}
A possible solution which you didn't try is to reset your python interpreter by using shortcuts Ctrl+Shift+P and type "Python: Select Interpreter".
One possible explanation is that your B_folder contains more files than pylance can handle in a workspace at once, while the C_folder does not. I was having a similar problem where pylance wouldn't work and then eventually a popup would inform me that pylance had crashed, but the problem only occurred in specific directories. It turned out the problem was that one of the folders in my workspace contained too many files for pylance to analyze, even though I hadn't opened anything in that folder.
In the workspace settings search python.analysis.exclude and type in the names of files, file types, and/or folders that pylance should exclude from its analysis. Then close out of vscode and reopen it.