Serhiy
Serhiy

Reputation: 4517

VSCode: installing Jupyter extension breaks variables usage linting

When Jupyter VSCode extension is removed - the python linting works fine for my notebooks. If some variable or import is defined but never used - there is a warning about that. But without this extension, I can't select the kernel and run the notebook. As soon as I install the extension, the linting goes crazy and shows warnings about "not accessed" variables for all variables and imports accessed in other cells.

enter image description here

Is there a way to disable Jypyter extension own linting or fix this issue? I couldn't find any VSCode setting that would allow me to do that.

Upvotes: 1

Views: 454

Answers (1)

Serhiy
Serhiy

Reputation: 4517

Even after disabling every single linting-related VSCode setting, there were still wrong linting errors shown in my notebooks. Googling on how to disable python linting completely led me to this SO answer suggesting changing the python.languageServer to None. For some reason, it was set to Pylance in my settings. Setting it to None did solve the issue for jupyter notebooks. Enabling the linting back didn't cause any problems and linting now works properly for both python files and jupyter notebooks.

TLDR, this is what helped in my case:

"python.languageServer": "None"

Now I can enable linting and it works properly:

"python.linting.enabled": true,
"python.linting.flake8Enabled": true

Upvotes: 0

Related Questions