I'm trying to run jupyter lab with miniconda, but Jupyter is having trouble connecting with the kernel. Below is some background info, the steps I've done, and the code that results.
Background Info
I have been successfully using jupyter lab for months.
It was only today that this problem started occurring.
I suspected that this is related to the fact that I installed XCode Command Line Tools 13 this morning, which was only released yesterday, but the same problem occurred after a downgrade to 12.5.1.
I am using miniconda.
Steps
Create a fresh conda environment
Activate it with conda activate test
I then run conda install jupyterlab
After installation, I run jupyter lab to open the browser and navigate to my .ipynb
Now, the bottom left corner of the browser reads "Python 3 (ipykernel) | Connecting", which doesn't say much. Here's a summary of the logs:
Regular log output
There's the initial info (which I don't think contains anything novel, but may help to answer some questions you might have that I haven't thought of):
[I 2021-09-21 09:36:33.353 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-09-21 09:36:34.278 ServerApp] nbclassic | extension was successfully linked.
[I 2021-09-21 09:36:34.509 LabApp] JupyterLab extension loaded from /opt/miniconda3/envs/test/lib/python3.9/site-packages/jupyterlab
[I 2021-09-21 09:36:34.509 LabApp] JupyterLab application directory is /opt/miniconda3/envs/test/share/jupyter/lab
[I 2021-09-21 09:36:34.515 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-09-21 09:36:34.526 ServerApp] nbclassic | extension was successfully loaded.
[I 2021-09-21 09:36:34.527 ServerApp] Serving notebooks from local directory: /Users/connorpancoast/Code/grassmaNN
[I 2021-09-21 09:36:34.527 ServerApp] Jupyter Server 1.4.1 is running at:
[I 2021-09-21 09:36:34.527 ServerApp] http://localhost:8888/lab?token=fa21e773398a0c8bbeccdb7a67ffb20950bac831209b9373
[I 2021-09-21 09:36:34.527 ServerApp] or http://127.0.0.1:8888/lab?token=fa21e773398a0c8bbeccdb7a67ffb20950bac831209b9373
[I 2021-09-21 09:36:34.527 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2021-09-21 09:36:34.535 ServerApp]
To access the server, open this file in a browser:
file:///Users/connorpancoast/Library/Jupyter/runtime/jpserver-24903-open.html
Or copy and paste one of these URLs:
http://localhost:8888/lab?token=fa21e773398a0c8bbeccdb7a67ffb20950bac831209b9373
or http://127.0.0.1:8888/lab?token=fa21e773398a0c8bbeccdb7a67ffb20950bac831209b9373
After this is when things get strange.
Strange log output
First is this warning about nodejs, which may or may not be important.
[W 2021-09-21 09:36:39.621 LabApp] Could not determine jupyterlab build status without nodejs
/opt/miniconda3/envs/test/lib/python3.9/json/encoder.py:257: UserWarning: date_default is deprecated since jupyter_client 7.0.0. Use jupyter_client.jsonutil.json_default.
return _iterencode(o, 0)
Next, the kernel starts, but there's a connection timeout.
[I 2021-09-21 09:36:51.114 ServerApp] Kernel started: b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:37:51.549 ServerApp] Timeout waiting for kernel_info reply from b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:37:56.092 ServerApp] Nudge: attempt 10 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:37:56.093 ServerApp] Nudge: attempt 10 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:37:56.109 ServerApp] Nudge: attempt 10 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
I'm unsure why three separate "nudge processes" are occurring, but after 120 nudge attempts (shown), this error message also appears three times, not shown for space:
[W 2021-09-21 09:38:51.474 ServerApp] Nudge: attempt 120 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:38:51.475 ServerApp] Nudge: attempt 120 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[W 2021-09-21 09:38:51.476 ServerApp] Nudge: attempt 120 on kernel b38270f5-9a72-42cf-86e5-0e8e4b3b9514
[E 2021-09-21 09:38:51.558 ServerApp] Uncaught exception GET /api/kernels/b38270f5-9a72-42cf-86e5-0e8e4b3b9514/channels?session_id=f834b0b3-b8ed-4b2d-bfc9-7a535593a24f (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/kernels/b38270f5-9a72-42cf-86e5-0e8e4b3b9514/channels?session_id=f834b0b3-b8ed-4b2d-bfc9-7a535593a24f', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/opt/miniconda3/envs/test/lib/python3.9/site-packages/tornado/websocket.py", line 956, in _accept_connection
await open_result
tornado.util.TimeoutError: Timeout
After those, these appear:
[W 2021-09-21 09:39:21.571 ServerApp] WebSocket ping timeout after 90003 ms.
[W 2021-09-21 09:39:21.585 ServerApp] WebSocket ping timeout after 90003 ms.
[W 2021-09-21 09:42:51.594 ServerApp] Replacing stale connection: b38270f5-9a72-42cf-86e5-0e8e4b3b9514:ee46fa70-0af0-489d-8993-acf4f55bf3aa
[W 2021-09-21 09:42:52.123 ServerApp] Replacing stale connection: b38270f5-9a72-42cf-86e5-0e8e4b3b9514:ee46fa70-0af0-489d-8993-acf4f55bf3aa
/opt/miniconda3/envs/test/lib/python3.9/json/encoder.py:257: UserWarning: date_default is deprecated since jupyter_client 7.0.0. Use jupyter_client.jsonutil.json_default.
return _iterencode(o, 0)
[I 2021-09-21 09:46:52.126 ServerApp] Starting buffering for b38270f5-9a72-42cf-86e5-0e8e4b3b9514:ee46fa70-0af0-489d-8993-acf4f55bf3aa
[W 2021-09-21 09:46:52.146 ServerApp] Replacing stale connection: b38270f5-9a72-42cf-86e5-0e8e4b3b9514:f834b0b3-b8ed-4b2d-bfc9-7a535593a24f
[W 2021-09-21 09:46:55.306 ServerApp] Replacing stale connection: b38270f5-9a72-42cf-86e5-0e8e4b3b9514:1db7c82b-2627-4c43-b9d3-da7bef15ca32
I also use Jupyter Lab with Miniconda, and this is what I did a few days ago.
It seems that you need the install node.js and ipykernel with:
conda install nodej ipykernel
Also, I read somewhere that you need to "tell" Jupyter Lab to use your environment as follow:
python -m ipykernel install --user --name test --display-name “enviroment_test”
Note that test is your environment name, and “enviroment_test” is the name that it will show in Jupyter.
Finally, I would suggest installing Jupyter from conda-forge with:
conda install jupyterlab -c conda-forge
Obs.: all this need to be done with your desired environment activated
Related
I have read the forums for jupyter notebook, VS code and other platforms not connecting to kernel. The problem is persistent across notebooks, lab, and VS code (the ones I primarily use). How can I connect to a kernel after trying changing the environment, and the suggested Tornado uninstall/reinstall? below is terminal output:
(base) C:\Users\stephen.bonacci>jupyter lab
NumExpr defaulting to 8 threads.
[I 2022-10-14 13:28:23.749 ServerApp] jupyterlab | extension was successfully linked.
[I 2022-10-14 13:28:24.202 ServerApp] nbclassic | extension was successfully linked.
[I 2022-10-14 13:28:24.202 ServerApp] panel.io.jupyter_server_extension | extension was successfully linked.
[I 2022-10-14 13:28:24.300 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-10-14 13:28:24.302 LabApp] JupyterLab extension loaded from C:\Users\stephen.bonacci\Anaconda3\lib\site-packages\jupyterlab
[I 2022-10-14 13:28:24.303 LabApp] JupyterLab application directory is C:\Users\stephen.bonacci\Anaconda3\share\jupyter\lab
[I 2022-10-14 13:28:24.309 ServerApp] jupyterlab | extension was successfully loaded.
/panel-preview/ /panel-preview
[I 2022-10-14 13:28:24.312 ServerApp] panel.io.jupyter_server_extension | extension was successfully loaded.
[I 2022-10-14 13:28:24.313 ServerApp] The port 8888 is already in use, trying another port.
[I 2022-10-14 13:28:24.315 ServerApp] Serving notebooks from local directory: C:\Users\stephen.bonacci
[I 2022-10-14 13:28:24.315 ServerApp] Jupyter Server 1.13.5 is running at:
[I 2022-10-14 13:28:24.316 ServerApp] http://localhost:8889/lab?token=e4b82b055f39ff980ad19e432534a4add1f65e15c5c244aa
[I 2022-10-14 13:28:24.317 ServerApp] or http://127.0.0.1:8889/lab?token=e4b82b055f39ff980ad19e432534a4add1f65e15c5c244aa
[I 2022-10-14 13:28:24.317 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2022-10-14 13:28:24.380 ServerApp]
To access the server, open this file in a browser:
file:///C:/Users/stephen.bonacci/AppData/Roaming/jupyter/runtime/jpserver-16912-open.html
Or copy and paste one of these URLs:
http://localhost:8889/lab?token=e4b82b055f39ff980ad19e432534a4add1f65e15c5c244aa
or http://127.0.0.1:8889/lab?token=e4b82b055f39ff980ad19e432534a4add1f65e15c5c244aa
[W 2022-10-14 13:28:29.305 LabApp] Could not determine jupyterlab build status without nodejs
[I 2022-10-14 13:28:34.832 ServerApp] Kernel started: 0c7e8334-2d31-41b8-97d0-2d8efa8d9630
[I 2022-10-14 13:28:37.805 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), new random ports
[I 2022-10-14 13:28:40.838 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (2/5), new random ports
[I 2022-10-14 13:28:43.851 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (3/5), new random ports
[I 2022-10-14 13:28:46.872 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (4/5), new random ports
[W 2022-10-14 13:28:49.915 ServerApp] AsyncIOLoopKernelRestarter: restart failed
[W 2022-10-14 13:28:49.915 ServerApp] Kernel 0c7e8334-2d31-41b8-97d0-2d8efa8d9630 died, removing from map.
I tried everything here and nothing worked:
Jupyter Notebook Server password invalid
How to disable password request for a Jupyter notebook session?
When I generate a password it doesn't give me a token but when I type in the password it doesn't work. When I copy and paste my token, it also doesn't work.
$ jupyter notebook --no-browser
[I 2022-08-04 13:37:32.069 LabApp] JupyterLab extension loaded from ~/anaconda3/lib/python3.9/site-packages/jupyterlab
[I 2022-08-04 13:37:32.069 LabApp] JupyterLab application directory is ~/anaconda3/share/jupyter/lab
[I 13:37:32.073 NotebookApp] Serving notebooks from local directory: /home/jespinoz
[I 13:37:32.073 NotebookApp] Jupyter Notebook 6.4.8 is running at:
[I 13:37:32.073 NotebookApp] http://localhost:8888/?token=469451b2e8ec80432a0948fbbe8662347695efd8f5339307
[I 13:37:32.073 NotebookApp] or http://127.0.0.1:8888/?token=469451b2e8ec80432a0948fbbe8662347695efd8f5339307
[I 13:37:32.073 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 13:37:32.132 NotebookApp]
To access the notebook, open this file in a browser:
file:///home/jespinoz/.local/share/jupyter/runtime/nbserver-3346536-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=469451b2e8ec80432a0948fbbe8662347695efd8f5339307
or http://127.0.0.1:8888/?token=469451b2e8ec80432a0948fbbe8662347695efd8f5339307
This did nothing:
c.NotebookApp.token = ''
c.NotebookApp.password = u''
c.NotebookApp.open_browser = True
c.NotebookApp.ip = 'localhost'
Neither did just this:
c.NotebookApp.token = ''
Nor this:
jupyter notebook password
Nor this:
jupyter notebook --ip='*' --NotebookApp.token='' --NotebookApp.password=''
Running one line of code "import pixiedust" makes the kernel die and automatically restart every time I try it. I'm using Jupyter Notebook via Anaconda in MacOS BigSur 11.2.3.
import pixiedust
this is my only line of code, the rest of my code works fine (the part not using pixiedust).
that's the terminal output:
Last login: Sat Mar 27 16:26:47 on ttys001
/Users/avic/opt/anaconda3/bin/jupyter_mac.command ; exit;
(base) avic#Avis-MBP ~ % /Users/avic/opt/anaconda3/bin/jupyter_mac.command ; exit;
[I 16:31:00.239 NotebookApp] JupyterLab extension loaded from /Users/avic/opt/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 16:31:00.239 NotebookApp] JupyterLab application directory is /Users/avic/opt/anaconda3/share/jupyter/lab
[I 16:31:00.242 NotebookApp] Serving notebooks from local directory: /Users/avic
[I 16:31:00.242 NotebookApp] The Jupyter Notebook is running at:
[I 16:31:00.242 NotebookApp] http://localhost:8888/?token=8d705f0c1f4efa59a8d4edc4643ad87ded410f4af2f62ea6
[I 16:31:00.242 NotebookApp] or http://127.0.0.1:8888/?token=8d705f0c1f4efa59a8d4edc4643ad87ded410f4af2f62ea6
[I 16:31:00.242 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 16:31:00.249 NotebookApp]
To access the notebook, open this file in a browser:
file:///Users/avic/Library/Jupyter/runtime/nbserver-57976-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=8d705f0c1f4efa59a8d4edc4643ad87ded410f4af2f62ea6
or http://127.0.0.1:8888/?token=8d705f0c1f4efa59a8d4edc4643ad87ded410f4af2f62ea6
[I 16:31:09.251 NotebookApp] Kernel started: b3400759-7e32-4b4d-87c8-77676fafe504
[I 16:31:15.255 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel b3400759-7e32-4b4d-87c8-77676fafe504 restarted
I've never used this workspace before but I'm required to by my uni...
Please help :)
What i have: NanoPi Neo2 (Allwinner A5 (arm v8 x64) processor, 512mb ram)
What I did:
apt-get install docker*
docker pull konmeo/jupyter (got here)
docker run -it --rm -p 8888:8888 4fdcd3a6ff59
it said [C 19:38:32.851 NotebookApp] Running as root is not recommended. Use --allow-root to bypass.
I runned docker run -it --rm -p 8888:8888 4fdcd3a6ff59 /usr/bin/jupyter notebook --allow-root, everything in docker is okay
[W 19:40:36.237 NotebookApp] server_extensions is deprecated, use nbserver_extensions
[I 19:40:36.287 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[I 19:40:39.827 NotebookApp] hide_code: Attempting to load hid_code export handler extensions.
[I 19:40:39.839 NotebookApp] hide_code: Hide_code export handler extensions loaded.
[I 19:40:39.972 NotebookApp] Loading IPython parallel extension
[I 19:40:40.238 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.2.4
[I 19:40:40.242 NotebookApp] Serving notebooks from local directory: /notebooks
[I 19:40:40.243 NotebookApp] 0 active kernels
[I 19:40:40.244 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=89a3809bd589557e08e31d7fbd475e6e17bb333fe2311745
[I 19:40:40.245 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 19:40:40.248 NotebookApp] No web browser found: could not locate runnable browser.
[C 19:40:40.250 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=89a3809bd589557e08e31d7fbd475e6e17bb333fe2311745
but I have no access neither using browser on local device nor using http://ip:8888/ in local network
What I should do to make it work?
Try binding docker to all interfaces.
-p 0.0.0.0:8888:8888
I'm on Mac OS 10.10.4.
When I run ipython notebook from command line, it gives me an error Cannot bind to localhost, using 127.0.0.1 as default ip [Errno 49] Can't assign requested address:
Yans-MacBook-Pro:/ yanyang$ ipython notebook
[W 01:32:12.908 NotebookApp] Cannot bind to localhost, using 127.0.0.1 as default ip
[Errno 49] Can't assign requested address
[I 01:32:12.912 NotebookApp] Serving notebooks from local directory: /
[I 01:32:12.913 NotebookApp] 0 active kernels
[I 01:32:12.913 NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
[I 01:32:12.913 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
It will cause more error later. How can I fix it?
localhost:~ yanyang$ lsof | grep 8888
Google 358 yanyang txt REG 1,4 16621568 26888859 /Users/yanyang/Library/Caches/Google/Chrome/Profile 5/Cache/data_4
Google 358 yanyang 90u REG 1,4 16621568 26888859 /Users/yanyang/Library/Caches/Google/Chrome/Profile 5/Cache/data_4
Google 358 yanyang 205u REG 1,4 3072 35352297 /Users/yanyang/Library/Application Support/Google/Chrome/Profile 5/Local Storage/http_127.0.0.1_8888.localstorage
Content of the file in the last line of the above block:
?????z!11?tableItemTableItemTableCREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)[!}1indexsqlite_aut?S???widgets:http://127.0.0.1:8888/notebooks/Downloads/PhillyCrime.ipynb{}?*?Qwidgets:http://127.0.0.1:8888/notebooks/Users/yanyang/Downloads/PhillyCrime.ipynb{}
??X?
?widgets:http://127.0.0.1:8888/notebooks/Downloads/PhillyCrime.ipynb?&?Q widgets:http://127.0.0.1:8888/notebooks/Users/yanyang/Downloads/PhillyCrime.ipynb
Thanks to #Petesh, I can use ipython notebook temperately now, using the command below:
ipython notebook --ip=127.0.0.1
And for further solution, I found that in my Mac's "/etc/hosts", 127.0.0.1 is not set to localhost. That's the final solution.