Skip to content
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

Jupyter notebook raises error: "NO notebook document" in VSCode (WSL v2) #5034

Open
BCGardner opened this issue Oct 27, 2023 · 32 comments
Open
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@BCGardner
Copy link

Environment data

  • Language Server version: v2023.10.50
  • OS and version: W10 Version 10.0.19045 and WSL 2 (Ubuntu 22.04.3 LTS)
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.11.5 (conda 4.10.3)

Repro Steps

  1. Launch VSCode and open an existing WSL project or create a new one.
  2. Create a new Jupyter notebook and save inside this project.
  3. In the first cell execute the following sample code (it might first be necessary to reload the window / restart the language server to enable Pylance features), e.g.:
x = range(10)
y = range(10, 20)
z = [i*j for i, j in zip(x, y)]
  1. Highlight some line of code to copy, e.g. x = range(10) and paste into a new cell.
  2. Try to execute the cell (repeating the above step if necessary until the error is raised)

Expected behavior

Cell executes normally, Pylance features such as syntax highlighting remain intact.

Actual behavior

The following notification appears in VSCode and the notebook hangs indefinitely:
NO notebook document for 'file:///*.ipynb'

Logs

2023-10-27 19:57:26.847 [info] [Info  - 7:57:26 PM] (3129) Pylance language server 2023.10.50 (pyright cfe56bfb) starting
2023-10-27 19:57:26.847 [info] [Info  - 7:57:26 PM] (3129) Server root directory: /home/lancelot/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.50/dist
2023-10-27 19:57:26.852 [info] [Info  - 7:57:26 PM] (3129) Starting service instance "pylance_debug"
2023-10-27 19:57:26.898 [info] [Info  - 7:57:26 PM] (3129) Setting pythonPath for service "pylance_debug": "/home/lancelot/miniconda3/envs/pylance-env/bin/python"
2023-10-27 19:57:26.898 [info] [Info  - 7:57:26 PM] (3129) Setting environmentName for service "pylance_debug": "3.11.5 (pylance-env conda)"
2023-10-27 19:57:26.922 [info] [Info  - 7:57:26 PM] (3129) Assuming Python version 3.11
2023-10-27 19:57:26.948 [info] [Info  - 7:57:26 PM] (3129) No source files found.
@rchiodo
Copy link
Contributor

rchiodo commented Oct 27, 2023

We don't control execution, so I don't think this would be a Pylance issue. Transferring to the Jupyter extension.

@rchiodo rchiodo transferred this issue from microsoft/pylance-release Oct 27, 2023
@edsaac
Copy link

edsaac commented Oct 27, 2023

Disabling or rolling back pylance seems to be the workaround for now.

Related: microsoft/vscode#196740

@rchiodo
Copy link
Contributor

rchiodo commented Oct 27, 2023

Hmm, maybe we are somehow messing up execution. I don't see how we could, but it's worth a look.

@rchiodo rchiodo transferred this issue from microsoft/vscode-jupyter Oct 27, 2023
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Oct 27, 2023
@rchiodo
Copy link
Contributor

rchiodo commented Oct 27, 2023

@KacieKK can you try to reproduce the problem?

@rchiodo
Copy link
Contributor

rchiodo commented Oct 27, 2023

I can't reproduce myself. Cells execute fine. I do get a problem with intellisense not working anymore, but that's been fixed in 2023.10.53.

@robertmaxton42
Copy link

robertmaxton42 commented Oct 28, 2023

When I first encountered the bug, I was able to reliably trigger it by clicking an error in the Problems pane, which then jumped to the error in a new temporary window -- by which I mean the sort of window with an italicized filename that gets automatically overwritten by the next command that opens a temporary window. The filename was identical to my original file (which I opened manually in a normal window), but fading for unused definitions and squiggles for errors only appeared in the temporary window, not in the original. Closing the temporary window resulted in the "NO notebook document" error.

After one or two rounds of this, however, it just stopped working entirely whether or not I opened and closed the weird temporary window.

This issue may be related: microsoft/vscode#173494.

@johnnyb1509
Copy link

image
I also face this problem, but only when I open the notebook at first, then "Run all" cell successfully at first. Then, if I select any cell to run again, it pops up me this warning message.

@albertocastany
Copy link

The problem disappears when downgrading to 2023.10.40

@Drfengze
Copy link

I met same problem.

@ian-jihoonpark
Copy link

This problem may be caused by the accumulated visualized outputs that you made.

Clear all outputs in your .ipynb!!

@pietrolesci
Copy link

Having the same issue on Ubuntu after the latest update

@nicolasbranco
Copy link

Same issue, changing the Pylance version seems to fix it for now. Was able to replicate on server on Ubuntu and WSL2.

@opassos
Copy link

opassos commented Nov 1, 2023

I have the exact same issue, both on WSL and native ubuntu
image

@opassos
Copy link

opassos commented Nov 1, 2023

The problem disappears when downgrading to 2023.10.40

I was having this problem before 2023.10.40 on WSL, maybe there is something else going on.

@Purewhite2019
Copy link

The problem disappears when downgrading to 2023.10.40

It also works for me :D

The only enabled extensions in my test environment are ms-toolsai.jupyter@2023.10.1003070148, ms-python.python@2023.20.0, ms-python.vscode-pylance@2023.10.50 and ms-vscode-remote.remote-ssh.

@Purewhite2019
Copy link

The problem disappears when downgrading to 2023.10.40

I was having this problem before 2023.10.40 on WSL, maybe there is something else going on.

Change Jupyter > Logging:Level to verbose in vscode settings and try again, is there any event like "Dispose Kernel process" inJupyter in the Output panel?

@adradr
Copy link

adradr commented Nov 2, 2023

same here - rolling back pylance solved, rolling back jupyter did nothing

@firezym
Copy link

firezym commented Nov 3, 2023

same here. switch python language server from pylance to jedi. then I got no such annoying errors anymore.

@pietrolesci
Copy link

The problem disappears when downgrading to 2023.10.40

This worked for me

@hierr
Copy link

hierr commented Jun 7, 2024

Still getting this error in the latest Pylance version (2024.6.1) on Debian 12

@dhepeyuvi
Copy link

Still getting this error in the latest Pylance version (2024.6.1) on Debian 12

True for me as well I get the error in WSL though.

@rchiodo
Copy link
Contributor

rchiodo commented Jun 11, 2024

I don't believe this error is actually caused by us. It's returned by VS code itself when it can't find a notebook document anymore.

We'd really need a repro in order to figure out if there's something we can do about it.

@otavio-silva
Copy link

Having this exact same problem in WSL2, can confirm downgrading fixed the issue so far.

@rchiodo
Copy link
Contributor

rchiodo commented Jul 5, 2024

Anybody that is hitting this issue, if you could provide steps on what you did to cause the problem, we'd greatly appreciate it.

@mohammadmoein
Copy link

mohammadmoein commented Jul 26, 2024

I'm experiencing an issue where the Jupyter Notebook kernel in VSCode unexpectedly dies, requiring me to restart VSCode. This occurs in two scenarios:

After a period of inactivity (approximately one minute or sometimes 2)
Randomly during code execution (e.g., while writing a loop)

To reproduce the issue:

Create a new Jupyter Notebook in VSCode
Run the following code:

import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(6, 4), columns=list('ABCD'))

Leave the notebook idle for about a minute
Attempt to use the df variable (e.g., print(df)). The kernel becomes unresponsive, and VSCode must be closed and reopened to regain functionality.

Environment:
VSCode: Latest Insider build
OS: Windows 10 with WSL

P.S
Disabling pylance did not solve the problem

@rchiodo
Copy link
Contributor

rchiodo commented Jul 26, 2024

@mohammadmoein, your problem would not be related to Pylance. You should log an issue on the Jupyter extension here:
https://github.com/microsoft/vscode-jupyter/issues

@sattary
Copy link

sattary commented Jul 26, 2024

now is July 2024 and the problem has not been resolved yet, are u joking with us? DEAR developers?

@rchiodo
Copy link
Contributor

rchiodo commented Jul 26, 2024

now is July 2024 and the problem has not been resolved yet, are u joking with us? DEAR developers?

Perhaps you missed my comment. We can't reproduce this in house. If you have a consistent repro, we'd love to try it.

@sattary
Copy link

sattary commented Jul 27, 2024

Anybody that is hitting this issue, if you could provide steps on what you did to cause the problem, we'd greatly appreciate it.

we simply open vs code in WSL2, create .ipynb files, start writing code, try to run cell, try to run another cell, try another, and try to run another cell but did not run. why? Pylance crashed.

it works in .py files without any problem.

i downgraded to 20 versions earlier but did not work. (tried all 20 version)

take a look this output from python lang server. it worked only 10 min.

2024-07-27 09:20:49.746 [info] [Info - 9:20:49 AM] (1189) Pylance language server 2023.10.40 (pyright 088ebaa5) starting
2024-07-27 09:20:49.746 [info] [Info - 9:20:49 AM] (1189) Server root directory: /home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist
2024-07-27 09:20:49.771 [info] [Info - 9:20:49 AM] (1189) Starting service instance "Type A copy"
2024-07-27 09:20:50.062 [info] s [Error]: Request workspace/configuration failed with message: Cannot read properties of undefined (reading 'metadata')
at /home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1472879
at oe (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1473173)
at /home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1467932
at Immediate. (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1467952)
at processImmediate (node:internal/timers:478:21) {
code: -32603,
data: undefined
}

2024-07-27 09:20:50.141 [info] [Info - 9:20:50 AM] (1189) Setting pythonPath for service "Type A copy": "/home/sat/venvs/moo-pymoo/bin/python"
2024-07-27 09:20:50.141 [info] [Info - 9:20:50 AM] (1189) Setting environmentName for service "Type A copy": "3.10.14 (moo-pymoo venv)"
2024-07-27 09:20:50.262 [info] [Info - 9:20:50 AM] (1189) Assuming Python version 3.10
2024-07-27 09:20:50.646 [info] [Info - 9:20:50 AM] (1189) Found 1 source file
2024-07-27 09:24:03.950 [info] s [Error]: Request workspace/configuration failed with message: Cannot read properties of undefined (reading 'metadata')
at /home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1472879
at oe (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1473173)
at /home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1467932
at Immediate. (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1467952)
at processImmediate (node:internal/timers:478:21) {
code: -32603,
data: undefined
}

2024-07-27 09:27:51.571 [info] [Info - 9:27:51 AM] (1189) Starting service instance "Type A copy"
2024-07-27 09:27:51.649 [info] [Info - 9:27:51 AM] (1189) Setting environmentName for service "Type A copy": "3.10.14 (moo-pymoo venv)"
2024-07-27 09:27:51.850 [info] [Info - 9:27:51 AM] (1189) Found 1 source file
2024-07-27 09:27:51.886 [info] Error: Debug Failure. False expression: Chained file path /home/sat/codes/foo/moo/courtyard-pro/Type A copy/opt.ipynb:pylance-notebook-cell:pylancePrefixCell.py doesn't match cellFilePaths /home/sat/codes/foo/moo/courtyard-pro/Type A copy/opt.ipynb:pylance-notebook-cell:W1sdnNjb2RlLXJlbW90ZQ==.py
at _0x8dd360 (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/server.bundle.js:1:919201)
at _0xdc6751._onDidOpenNotebookDocumentAsync (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/server.bundle.js:1:903512)

2024-07-27 09:27:55.348 [info] [Info - 9:27:55 AM] (1189) [BG(2)] Long operation: analyzing: /home/sat/codes/foo/moo/courtyard-pro/Type A copy/opt.ipynb:pylance-notebook-cell:X11sdnNjb2RlLXJlbW90ZQ==.py (2633ms)
2024-07-27 09:27:55.846 [info] [Info - 9:27:55 AM] (1189) [BG(2)] Long operation: analyzing: /home/sat/codes/foo/moo/courtyard-pro/Type A copy/opt.ipynb:pylance-notebook-cell:pylancePrefixCell.py (3129ms)
2024-07-27 09:29:00.829 [info] s [Error]: Request workspace/configuration failed with message: Cannot read properties of undefined (reading 'metadata')
at /home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1472879
at oe (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1473173)
at /home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1467932
at Immediate. (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/vendor.bundle.js:2:1467952)
at processImmediate (node:internal/timers:478:21) {
code: -32603,
data: undefined
}

2024-07-27 09:40:22.693 [info] Error: Debug Failure. False expression: Chained file path /home/sat/codes/foo/moo/courtyard-pro/Type A copy/opt.ipynb:pylance-notebook-cell:pylancePrefixCell.py doesn't match cellFilePaths /home/sat/codes/foo/moo/courtyard-pro/Type A copy/opt.ipynb:pylance-notebook-cell:W1sdnNjb2RlLXJlbW90ZQ==.py
at _0x8dd360 (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/server.bundle.js:1:919201)
at _0xdc6751._onDidOpenNotebookDocumentAsync (/home/sat/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/server.bundle.js:1:903512)

2024-07-27 09:43:22.824 [info] [Error - 9:43:22 AM] Sending DidCloseNotebookDocumentNotification failed
2024-07-27 09:43:22.824 [info] Message: Client is not running
Code: -32096
2024-07-27 09:43:26.032 [info] [Error - 9:43:26 AM] Sending DidOpenNotebookDocumentNotification failed
2024-07-27 09:43:26.032 [info] Message: Client is not running
Code: -32096
2024-07-27 09:43:29.072 [info] [Error - 9:43:29 AM] Sending DidCloseNotebookDocumentNotification failed
2024-07-27 09:43:29.073 [info] Message: Client is not running
Code: -32096

@sattary
Copy link

sattary commented Jul 27, 2024

I find that the problem is going with Continue AI assistant, when I disabled continue everything works well. guys please migrate to this issue continuedev/continue#1463

@timsu92
Copy link

timsu92 commented Jul 29, 2024

If someone not using Continue but WSL2 or Azure, some discussions (and maybe solutions) are here: microsoft/vscode-jupyter#15716

@KacieKK
Copy link
Contributor

KacieKK commented Jul 29, 2024

Thanks for posting. For chained path issue, which is different to this original post, please track it in #6169.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests