13

Pylance works for .py files:

.py with pylance

But doesn't work with Jupyter .ipynb notebooks:

.ipynb with pylance

I tried saving the .ipynb - same issue.

How can enable Pylance warnings in my notebooks?

Tom Hale
  • 40,825
  • 36
  • 187
  • 242
  • I don't think Pylance was built to work with notebooks. I would create a VS code interactive file instead. – Paul H Jan 05 '21 at 00:43

3 Answers3

9

It seems that the Jupyter extension doesn't support Pylance.

I submitted this issue to address this shortcoming:

Pylance / Language server support #4307

Tom Hale
  • 40,825
  • 36
  • 187
  • 242
2

I had this same problem and fixed by uninstall the jupyter extention and install the latest version of it.

Probably Tom has already solved your problem but if someone else is here looking for help that might solve it.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 12 '21 at 14:37
  • 1
    reinstalling doesn't seem to have any effect. – Yar Mar 31 '22 at 21:49
0

In my case Pylance was ignoring imports and variables. Restarting the Jupyter kernel solved it.

  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/33028009) – GAVD Oct 31 '22 at 07:24