-
Notifications
You must be signed in to change notification settings - Fork 771
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 crashing on Jupyter Notebook Cell Deletion #4685
Comments
Downgrading to v2023.7.40 seems to have solved the issue. Bug maybe introduced in new version? |
Can confirm, 2023.8.10 seems completely broken for notebooks. |
Did you reorder any cells or put anything in the notebook before adding the 3? extra cells at the bottom? No matter how many cells or where I put them, I can't get it to crash. But maybe reordering first is necessary. |
Freshly opened vscode using reload window, then added the cells. Just happen to me on this particular version. I can try using venv to follow your gif there. Might followup in 12 hours |
Hmm, maybe it has to do with deleting the cells while pylance is loading. At least in your situation it looked like pylance hadn't finished starting when you were deleting. |
I think i tried waiting a few seconds before deleting another cell. Still broke the server though. But deleting from bottom to top in order seems fine. |
I'm getting a similar issue when deleting cells in Jupyter notebook. See my post here for a video: microsoft/vscode#189645 (comment) I get the same error "Error: Debug Failure. False expression: Chained file path undefined doesn't match cellFilePaths" |
Note: Downgrading to v2023.7.40 doesn't solve the issue for me. |
Yep, same here. And downgrading won't help, since I've been having this issue for months. Glad to see that others are having it too. I'm not sure if "crashing" is the right term, since it seems to continue to log to the output tab. But the functionality definitely dies, and won't recover on its own. Related issues:
Some of my details:
Settings are mostly default, with these exceptions:
What I see, which seems the same as OP:
And, just FYI, the pre-release version of Pylance (2023.8.11) has exactly the same issue. |
We really need a way to repro the problem. Nobody in house can seem to reproduce the issue. Does it happen no matter the notebook? |
I think the cleanest reproduction steps, which works for me, is something like this:
Edit: Argh, now this won't replicate exactly this way. I ended up adding a cell at the top importing a package, like Edit2: I keep attempting to find the most succinct way to replicate. And for some reason, creating a cell at the top and then deleting it seems to more consistently break Pylance? But, I know from my own work with large notebooks, it will consistently break without me deleting the top cell, and eventually breaks after deleting any cell. So, maybe some sort of effect here from the number of cells, amount of code, or session runtime of a notebook? Apologies, this is the best I can do I think - I don't understand how Pylance works, or how it works with Jupyter :-). |
Yeah I still can't repro. Doesn't matter where I create a cell. |
Can you try this? I used D+D to delete the middle cell and Z to undo the delete Untitled.video.mp4 |
Nope that works fine. Deleting the cell, moving it around, doesn't matter. The code that's failing is detecting that we understand all of the cells in the notebook (they get turned into files that reference each other). When the error occurs, one of the cells is set to undefined for some reason. |
Can you try an experimental setting?
This changes how we handle LSP messages. That setting forces us to handle one message at a time. The bug here might be we're getting a delete for a notebook cell while we get an edit for a cell and the delete might be deleting a cell we were editing. Sync server mode should make those two messages happen synchronously. |
Oh, should have said that new mode requires restarting VS code. |
Not helping on my side. The crash message looks slightly different though :
|
That did make some progress. Autocomplete keeps working now, but objects are underlined as if they don't exist (
|
That probably means the 'crash' for the async server is not crashing the sync server. But the data is still messed up. Meaning it still repros. |
Just to double check, everyone hitting this is using either the latest VS code insiders or VS code stable? I tried with stable: 1.81 Thought maybe VS code changed notebook sync messages. |
I’m using stable, but tomorrow I can also try with insiders if that would be useful. |
No, I don't think that matters. I really doubt VS code changed these messages at all. There's some race condition we have in Pylance. |
Using stable 1.81, ms-python.vscode-pylance-2023.8.20 on linux machine pylance keeps crashing with mentioned error message. remote and local. Can reproduce by deleting two cells consecutively. |
Related on Stack Overflow: Pylance in VS Code crashes when adding or deleting cells in a Jupyter notebook. I'm maintaining an answer post with what's been notably written here. Apparently some need to downgrade further to 2023.7.30 (source). |
So since we are Wednesday can we get any confirmation that the pre release build that will be released today fixes this issue? |
Problem was fixed after installing Pyright v1.1.325. I will update if it crashed again. Update: well. it crashed again. |
There was an additional fix that isn't in Pyright. it's only in pylance at the moment. |
When we ship the next Pylance prerelease, the bug should be fixed. That would be 2023.8.51 |
This issue has been fixed in prerelease version 2023.8.51, which we've just released. You can find the changelog here: CHANGELOG.md |
@thehappycheese do you still have a UNC issue? That's likely this problem: #4357. Which I believe was related to how VS code prevented access to UNC drives. Can you log an issue whatever the problem may be? |
I am on |
@jzazo, after that happens, if you add/delete/reorder a cell, does Pylance crash with an error like the one below? If not, it's a different issue.
|
Can confirm that upgrading to Pylance 2023.8.51 worked for me. For now. Thank you all for working on this. |
I am not using jupyter or interpreted python, I am on a normal python module, and pylance stops working. Yeah, it may happen when I reorder code, is that possible? |
@jzazo, the identifying behavior of this issue is the crash. The fact that semantic highlighting stops working just before the crash is a symptom of the underlying problem, but there are many reasons that semantic highlighting could stop working. It's impossible for this crash to occur without opening a notebook. The code where the "Chained file path x doesn't match cellFilePaths" check is performed is only executed when VS Code tells Pylance that a notebook has been opened or modified. So what you're seeing is a different issue. Can you please open a new issue? The only existing issue I found that looked similar is #4513, but I don't think there's enough detail there yet for us to know if it's the same as your issue. So open a new one and we can always resolve it as a duplicate after investigation if appropriate. |
Thanks, I will keep monitoring and report back if I observe it crashes. |
@jzazo, sorry if I wasn't clear. When the semantic highlighting (colored text) changes to white, which of the following options is true for you? Note that having a notebook "open" does not necessarily mean that it is the active tab that you are typing in. Simply having it open as another tab may be sufficient to cause this issue. No notebooks are openIf you don't have any notebooks open when you see the semantic highlighting (colored text) change to white, then what you are seeing is unrelated to this issue. File a new issue please. 1+ notebook is open and adding/deleting/reordering cell does not cause this crashIf you do have a notebook open (as an open tab, but not necessarily the active tab) when you see the semantic highlighting (colored text) change to white (in any file), then when that color change occurs, please switch to the open notebook and try adding, deleting, or reordering a cell there. If that doesn't cause the crash I mentioned above, then what you are seeing is unrelated to this issue. File a new issue please. 1+ notebook is open and adding/deleting/reordering cell causes this crashIf you see the coloration disappear with a notebook open, and adding/deleting/reordering a cell causes the crash I mentioned above, and you are using 2023.8.51, then what you're seeing is related to this issue and we'll need more details on your project and what actions you are taking before the problem occurs. |
Thanks @debonte. Yeah, I don't have any notebooks open, so it is an unrelated issue. I will keep monitoring, it doesn't happen as frequently as before. |
I have upgraded today to the Syntax highlighting and autocompletion worked flawlessly all day (if a bit slow due to the huge notebook size). No crashes (that I know of). With recent previous versions, I used to experience a loss of syntax highlighting and autocompletion after a while, that required closing/reopening the notebook. I have never seen any crashes with previous versions (may have occurred, I just never saw them). I believe the Thanks @debonte |
I am on
|
The same problem in my jupyter notebook. I used plotly lib to visualization, and after i deleted cell with plot pylance server was crashed my version: 1.85.0-insider (user setup) |
The deleting of the cell is actually tracked in a separate issue. This one: #5071. The fix for that should be in the next prerelease version when we ship it. Otherwise I'd recommend switching to stable. |
This issue happens again for my Pylance in version 2023.8.50 |
@LicoriceLin, If that's your version, you should upgrade. This bug has been fixed since 2023.11.12 |
Oh thanks! |
Oh I think it's a new issue as update doesn't fix it. And my error log goes like " Received change text document command for closed file": |
In my situation any change to jupyter codes, even if it's in the existent blocks, will make pylance crash |
That sounds like this problem then: Which looks to be an issue with VS code: If you downgrade VS code to 1.86.2, the problem should go away. |
Environment data
Repro Steps
Expected behavior
Logs
The text was updated successfully, but these errors were encountered: