-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 Lab hangs on startup and then 'tcgetpgrp failed: Not a tty' appears (in WSL2) #10413
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Hey @NicoJG Are you using a browser on Windows or on Ubuntu. I would strongly recommend starting JupyterLab without opening a browser (see open_browser configuration option or
|
I am using Firefox on Windows, which is (probably) opened via
I forgot to mention that... |
So this is not related to jupyter and it is linked to WSL machinery.
Using WSL is pretty advanced, there will be no support of virtual machines as you can use the native version and there are too many virtual technology out there.
I would definitely not recommend for beginners to use virtual machines. |
Any luck with this issue? I am having a similar but not identical issue where --no-browser prevents the tcgetpgrp error, but WSL still hangs and fails to provide a command prompt while a Jupyter server is running. This is the only related thread or resource I've been able to find. |
I am still having this issue, even after a clean installation of Windows 10 and WSL (with Anaconda). Fix (somewhat)What "fixed it" for me was to either to use Bug descriptionIf I don't use this option, I can weirdly start the server instantly by pressing Ctrl-C once after When I open and close a few Jupyter Lab instances one after another and let the last one run, then after a few minutes the tcgetpgrp error appears as many times as I opened instances, and it even opens as many tabs in my browser correctly displaying Jupyter Lab. This whole bug seems so avoidable to me. Jupyter waits for a response of something and instantly continues if the user "threatens to interrupt" using Ctrl-C. Then it waits for some tcgetpgrp response, even though the server is running just fine already. Important Notes:
|
This behaviour is kind of intended. While the Jupyter Server is running, there should be no command prompt. |
@NicoJG Good to know how it looks on your end. I think we're getting different but related bugs, possibly due to me being on Windows 11. I actually managed to get help from a Discord server I'm on (for the Obsidian notetaking app), which may or may not solve the underlying issue, but seems to make everything work right for me. Here's the script I'm using, with identifying information obfuscated: alias env123="cd '/mnt/d/documents/abc/s2022/abcd 123' && conda activate abcd123 && xdg-open http://localhost:8888/?token=[etc] && jupyter notebook --no-browser &" Jupyter still hangs the current process when started, so it has to be the last command. However, xdg-open takes a second or two to open a link in browser, so it seems to work out. Your original and reiterated mention of --no-browser allowed me to find this post by the tcgetpgrp error, and it does clean up the output of starting jupyter for me. The key to making the prompt work right was the &. Adding & to jupyter notebook starts it in the background, so it doesn't take over the prompt, then fg or ps can be used to foreground it in order to close it. I have to press enter once after the script runs to get a prompt, but it works, and that might even be scriptable if it's an annoyance. Let me know if this works on your end! |
@atimeofday interesting solution. I would suggest using I did not know about the |
This is not correct; this issue is not WSL-specific. The problem is that by default jupyter(lab) attempts communication via temporary files. This is bound to be a trouble, e.g. due to sandboxing of browsers: similar issues are mentioned for running notebooks on Ubunty with snap-installed Firefox (which doesn't see user's dotfiles), or on ChromeOS (where jupyter is run in a Linux VM, and uses host (ChromeOS) browser.
Quite a few projects using jupyter do not run natively on the OS of the browser, be it Windows, or ChromeOS. @fcollonval @jasongrout - can this be re-opened? |
Description
In short: Jupyter Lab (and Jupyter Notebook) needs a long time to start. And opens it in the browser far to late (after a
tcgetpgrp failed: Not a tty
error). (in WSL2 with Ubuntu)What happens:
Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
.To access the server, open this file in a browser: ...
shows up and I can access Jupyter Lab (and Notebook) in the browser. But it does not open automatically.tcgetpgrp failed: Not a tty
and the browser opens a new tab with Jupyter Lab.A few things I noticed:
$ jupyter lab --no-browser
everything works perfectly fine (Edited)Ctrl+C
it does not interrupt, but starts the server immediatly. But thetcgetpgrp failed: Not a tty
still pops up after a few minutes and opens a new browser tab.Ctrl+C
a Python error shows up and it stops the server. But strangelytcgetpgrp failed: Not a tty
still pops up after a few minutes and is just printed in the terminal. Even though jupyter is closed minutes ago. It also opens the browser but the connection could not be established since no jupyter server is running.c.NotebookApp.use_redirect_file = False
in the~/.jupyter/jupyter_notebook_config.py
. But thetcgetpgrp failed: Not a tty
still popped up and I just ignored it. The long waiting is the thing that annoys me now. This fix worked for many people I helped setting up WSL, but I always just ignored the error.Reproduce
zsh
, but I expect this to not be necessary for reproduction)$ jupyter notebook --generate-config
c.NotebookApp.use_redirect_file = False
in~/.jupyter/jupyter_notebook_config.py
jupyter lab
from anywhereCtrl+C
and doubleCtrl+C
Expected behavior
Well after
$ jupyter lab
or$ jupyter notebook
it should start the server and open the browser in a few seconds.Context
Troubleshoot Output
Command Line Output with `--debug` and waiting
Command Line after a single `Ctrl+C`
Command Line Output after double `Ctrl+C`
Browser Output
The text was updated successfully, but these errors were encountered: