-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pylance is not work for jupyter notebook in VScode #4742
Comments
I believe I have the same problem. Syntax highlighting tends to disappear if I scroll quickly up through a notebook. Any sufficiently large notebook will do - e.g. I have one with 7 cells, one of the cells makes a matplotlib graph. I've attached it here to help troubleshooting, but it happens with all notebooks I'm using. I have to close the notebook, close the folder, re-open the folder, and reload the notebook to fix syntax highlighting and contextual help. It's quite disruptive to my work. I have the latest versions of everything VSCode. I have Python 3.11.4, and the latest relevant Python modules. No Anaconda, no venv. I run Jupyter remotely via the ssh extension. Laptop runs Win10, remote dev machine runs Ubuntu 22.04. |
I have the same problem. When Pylance does not work in the notebook, it seems that it still works in .py files opened in other tabs. ctrl+shift+p and "clear cache and reopen window" can fix the syntax issue in the notebook, but it is really annoying and cells need to re-run. |
Just chipping in, same issue here. Python 3.9 in vscode, no conda or other env. Pylance works flawlessly in native .py files, but has zero presence in ipynb files. All ran locally. |
Same issue, Pylance does work in Jupyter VSCode, but sometimes it just stops working and everything breaks, as a side note, I'm also using GitHub Copilot, and it seems that when Pylance stops working so does Copilot, it starts spiting no-sense code that does not relate to my work. I've tried disabling Copilot to see if it is some sort of incompatibility, but Pylance still breaks if I scroll too fast or change something abruptly in the notebook. |
Any known workarounds? This bug makes VSCode nearly unusable for me. |
If this is the same as #4733, I believe you could work around this by rolling back to 2023.5.40 or earlier. Note that despite the word "crash" in the issue title, the underlying issue can cause all semantic highlighting, hovering, etc to break and you won't hit a Pylance crash until you attempt to add/remove/reorder cells. |
I am having the exact same issue (as described in microsoft/vscode#190981 (comment)) But i know many other people have been having similar issues for what seems a while (see https://stackoverflow.com/questions/59775038/visual-studio-code-syntax-highlighting-not-working#:~:text=In%20my%20case%20I%20needed,as%20source%20for%20the%20problem.) im really not sure about the fix. I have also done everything to try fix this issue from reinstalling to formatting my pc (i did that for other reasons too). i used to find when my Python notebook got really large with lots of figures then the color syntax highlighting broke. Now it seems it just breaks after having the notebook open for a few minutes or it just breaks randomly. |
Just wanted to mention the issue is not only with jupyter notebooks or interactive python, but happens in every python module. |
I would like to thank all of you. |
2023.5.40 appears to work well, I've used it for maybe 2 - 3 hours today on a large notebook without any problem. 2023.8.41 pre-release worked fine for about 30 min on the same large notebook, but after that again I lost syntax highlighting and tab completion. It seems to last a bit longer than the most recent stable release, but this is based on only one try. The notebook is a fork of this one below, but with many edits by me (lots of graphics): https://www.kaggle.com/code/filterjoe/time-series-bonus-lesson-unofficial Dataset: https://www.kaggle.com/competitions/store-sales-time-series-forecasting/data |
Indeed downgrading to 2023.5.40 worked! Thank you! |
I agree, |
@mikeyau1, when you see this issue, if you add/delete/reorder a cell, do you see Pylance crash with an error similar to this?
|
@debonte I hit the same error again by opening a folder like #4733. How can I see the log which related to the pylance because I see some error in OUTPUT of Extension Host page? But I am not sure it is Pylance related. My environment setting and VS Code version is the same as beginning. I did not update to 2023.8.41. |
I got the similar message
|
@debonte Yes, I get the exact same error on my linux desktop. |
Ok, then this is a duplicate of #4685. Note that there are two stages to this bug. First you lose language server functionality (ex. hover, semantic highlighting) as you described above and then if you change the structure of an affected notebook Pylance will crash with the So far I've found two ways that this problem can happen. One is described in #4733 and was fixed in 2023.8.41. The other is described in #4685 (comment), and I expect to be fixed in our next prerelease build. |
I am still facing the same issue on 2024-July. I have vscode updated to latest version and I am using Ubuntu |
@sayedabdallah, can you open a new issue? Your problem is likely not related to this and we'd need logs and/or repro steps to fix your issue. |
@rchiodo yes I found out that it is an issue with pyspark only and I had to install pyspark-stubs too to get it to work |
Still happening to me as well. But the fix from @yehaixuan4428 appears to work |
there was some notebook bug in a package we depend on. we updated that dependency on the latest pylance (104) and python extension prerelease. can you try the latest pylance/python prerelease to see whether the issue still happening. and if it still happens, it could be better for us to track the issue if you open new issue for your issue. |
I switched to pre-release and restarted VSCode, still appears to be happening even after I select my Poetry .venv ): Happy to provide more info. @heejaechang Thanks. Edit: Specifically the imports are staying |
@the-rich-piana can you open a new issue with log? so we can track it separately and see what's going on? |
Applies To
What happened?
Pylance is not stable. When I open the notebook, it works for 1-2 hours. Then, the color of variables become white, and Pylance is unable to scan error. I check some issue in GitHub (microsoft/vscode-jupyter#8374 (comment)). I try to add a new cell. but it gives nothing to jx:
Also, it detect a comment line as error. it also cannot show the object selector
VS Code Version
Version: 1.81.1 (user setup) Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794 Date: 2023-08-09T22:22:42.175Z Electron: 22.3.18 ElectronBuildId: 22689846 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.19045
Jupyter Extension Version
v2023.7.1002162226
Jupyter logs
No response
Coding Language and Runtime Version
Python 3.11.0
Language Extension Version (if applicable)
Pylance: v2023.8.20
Anaconda Version (if applicable)
2023.07
Running Jupyter locally or remotely?
N/A or Not sure
The text was updated successfully, but these errors were encountered: