Connection failed A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
[I 08:18:54.461 NotebookApp] The port 8888 is already in use, trying another port.
[W 08:18:54.548 NotebookApp] Error loading server extension jupyterlab
Traceback (most recent call last):
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\jupyter_server\prometheus\metrics.py", line 12, in
from notebook.prometheus.metrics import HTTP_REQUEST_DURATION_SECONDS, TERMINAL_CURRENTLY_RUNNING_TOTAL, KERNEL_CURRENTLY_RUNNING_TOTAL
ModuleNotFoundError: No module named 'notebook.prometheus'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\AYOOLA\AppData\Roaming\Python\Python39\site-packages\notebook\notebookapp.py", line 1546, in init_server_extensions
mod = importlib.import_module(modulename)
File "C:\Users\AYOOLA\anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\jupyterlab\__init__.py", line 7, in
from .labapp import LabApp
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\jupyterlab\labapp.py", line 15, in
from jupyter_server.serverapp import flags
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\jupyter_server\serverapp.py", line 74, in
from .log import log_request
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\jupyter_server\log.py", line 10, in
from .prometheus.log_functions import prometheus_log_method
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\jupyter_server\prometheus\log_functions.py", line 1, in
from .metrics import HTTP_REQUEST_DURATION_SECONDS
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\jupyter_server\prometheus\metrics.py", line 18, in
HTTP_REQUEST_DURATION_SECONDS = Histogram(
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\prometheus_client\metrics.py", line 522, in __init__
super(Histogram, self).__init__(
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\prometheus_client\metrics.py", line 121, in __init__
registry.register(self)
File "C:\Users\AYOOLA\anaconda3\lib\site-packages\prometheus_client\registry.py", line 29, in register
raise ValueError(
ValueError: Duplicated timeseries in CollectorRegistry: {'http_request_duration_seconds_bucket', 'http_request_duration_seconds_sum', 'http_request_duration_seconds_count', 'http_request_duration_seconds', 'http_request_duration_seconds_created'}
[I 08:18:55.084 NotebookApp] Serving notebooks from local directory: C:\Users\AYOOLA
[I 08:18:55.084 NotebookApp] The Jupyter Notebook is running at:
[I 08:18:55.085 NotebookApp] http://localhost:8889/?token=23edeb43832f8c4f496974d14f56a20d73a6d39c62eaff45
[I 08:18:55.088 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 08:18:55.169 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8889/?token=23edeb43832f8c4f496974d14f56a20d73a6d39c62eaff45
[I 08:18:55.504 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 08:19:01.289 NotebookApp] Creating new notebook in
[I 08:19:07.508 NotebookApp] Kernel s

tarted: 6d7706bb-9c3a-45bb-83fa-818a37558650
C:\Users\AYOOLA\AppData\Roaming\Python\Python39\site-packages\notebook\base\zmqhandlers.py:284: RuntimeWarning: coroutine 'WebSocketHandler.get' was never awaited
super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
[W 08:19:19.392 NotebookApp] Replacing stale connection: 6d7706bb-9c3a-45bb-83fa-818a37558650:055aec577cea45ff8010a498ac720c18
Contributor guide
Research direction
Start with the traceback in jupyter_server/prometheus/metrics.py and notebook/base/zmqhandlers.py, using the reported Anaconda Python 3.9 environment to reproduce the server startup and reconnect behavior. Done means the Jupyter server starts without the extension and WebSocket errors and the notebook remains connected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, prometheus, python
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100