Newly installed Jupyter Notebook, but it won't connect to Kernel

Hi Everyone!

First of all, thank you for your time reading this and helping me out.

I recently installed Jupyter Notebook on my new laptop through anaconda installer (Windows 10). However, my notebook somehow could not connect to Kernel. I have tried different ways found via google search (e.g. downgrading tornado, deactivating VPN/Anti-virus and etc.), but none of them has worked out.

The pop up stated: “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.”

Below is the output from terminal and packages installed.

(base) PS C:\Users\HP> jupyter kernel
[KernelApp] Starting kernel 'python3'
[KernelApp] Connection file: C:\Users\HP\AppData\Roaming\jupyter\runtime\kernel-9b286025-98a9-48a3-9517-8070e915f7af.json
Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)
[KernelApp] To connect a client: --existing kernel-9b286025-98a9-48a3-9517-8070e915f7af.json
Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)
Exception in thread Thread-4:
Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)
Traceback (most recent call last):
  File "C:\Users\HP\anaconda3\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\HP\anaconda3\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\HP\anaconda3\lib\site-packages\ipykernel\iostream.py", line 78, in _thread_main
    self.io_loop.start()
  File "C:\Users\HP\anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 199, in start
    self.asyncio_loop.run_forever()
  File "C:\Users\HP\anaconda3\lib\asyncio\base_events.py", line 570, in run_forever
    self._run_once()
  File "C:\Users\HP\anaconda3\lib\asyncio\base_events.py", line 1823, in _run_once
    event_list = self._selector.select(timeout)
  File "C:\Users\HP\anaconda3\lib\selectors.py", line 323, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "C:\Users\HP\anaconda3\lib\selectors.py", line 314, in _select
    r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] An operation was attempted on something that is not a socket
(base) PS C:\Users\HP> [IPKernelApp] WARNING | Parent appears to have exited, shutting down.

The output from terminal when I tried to open a notebook:

(base) PS C:\Users\HP> jupyter notebook
[I 18:31:00.265 NotebookApp] Serving notebooks from local directory: C:\Users\HP
[I 18:31:00.265 NotebookApp] Jupyter Notebook 6.4.0 is running at:
[I 18:31:00.265 NotebookApp] http://localhost:8888/?token=b6e123f743016445c127b98a6ce007aec6602ea7db603aee
[I 18:31:00.265 NotebookApp]  or http://127.0.0.1:8888/?token=b6e123f743016445c127b98a6ce007aec6602ea7db603aee
[I 18:31:00.265 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:31:00.309 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/HP/AppData/Roaming/jupyter/runtime/nbserver-14636-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=b6e123f743016445c127b98a6ce007aec6602ea7db603aee
     or http://127.0.0.1:8888/?token=b6e123f743016445c127b98a6ce007aec6602ea7db603aee
[W 18:31:11.218 NotebookApp] Notebook Documents/Untitled.ipynb is not trusted
Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)
[I 18:31:11.298 NotebookApp] Kernel started: 577822af-00c9-445c-8591-bebaa52d29ca, name: python3
[W 18:31:11.314 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20210601183100 (::1) 10.990000ms referer=http://localhost:8888/notebooks/Documents/Untitled.ipynb
[I 18:31:11.328 NotebookApp] Shutting down 1 kernel
Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)
Bad address (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)
(base) PS C:\Users\HP> [IPKernelApp] WARNING | Parent appears to have exited, shutting down.

Package installed:

(base) PS C:\Users\HP> conda list
# packages in environment at C:\Users\HP\anaconda3:
#
# Name                    Version                   Build  Channel
anaconda-client           1.7.2                    py38_0
anaconda-navigator        2.0.3                    py38_0
argon2-cffi               20.1.0           py38h2bbff1b_1
async_generator           1.10               pyhd3eb1b0_0
attrs                     21.2.0             pyhd3eb1b0_0
backcall                  0.2.0              pyhd3eb1b0_0
backports                 1.0                pyhd3eb1b0_2
backports.functools_lru_cache 1.6.4              pyhd3eb1b0_0
backports.tempfile        1.0                pyhd3eb1b0_1
backports.weakref         1.0.post1                  py_1
beautifulsoup4            4.9.3              pyha847dfd_0
bleach                    3.3.0              pyhd3eb1b0_0
brotlipy                  0.7.0           py38h2bbff1b_1003
bzip2                     1.0.8                he774522_0
ca-certificates           2021.5.25            haa95532_1
certifi                   2020.12.5        py38haa95532_0
cffi                      1.14.5           py38hcd4344a_0
chardet                   4.0.0           py38haa95532_1003
click                     8.0.1              pyhd3eb1b0_0
clyent                    1.2.2                    py38_1
colorama                  0.4.4              pyhd3eb1b0_0
conda                     4.10.1           py38haa95532_1
conda-build               3.21.4           py38haa95532_0
conda-content-trust       0.1.1              pyhd3eb1b0_0
conda-env                 2.6.0                         1
conda-package-handling    1.7.3            py38h8cc25b3_1
conda-repo-cli            1.0.4              pyhd3eb1b0_0
conda-token               0.3.0              pyhd3eb1b0_0
conda-verify              3.4.2                      py_1
console_shortcut          0.1.1                         4
cryptography              3.4.7            py38h71e12ea_0
decorator                 5.0.9              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
entrypoints               0.3                      py38_0
filelock                  3.0.12             pyhd3eb1b0_1
freetype                  2.10.4               hd328e21_0
future                    0.18.2                   py38_1
glob2                     0.7                pyhd3eb1b0_0
icu                       58.2                 ha925a31_3
idna                      2.10               pyhd3eb1b0_0
importlib-metadata        3.10.0           py38haa95532_0
importlib_metadata        3.10.0               hd3eb1b0_0
ipykernel                 5.3.4            py38h5ca1d4c_0
ipython                   7.24.0                   pypi_0    pypi
ipython_genutils          0.2.0              pyhd3eb1b0_1
jedi                      0.17.0                   py38_0
jinja2                    3.0.0              pyhd3eb1b0_0
jpeg                      9b                   hb83a4c4_2
jsonschema                3.2.0                      py_2
jupyter_client            6.1.12             pyhd3eb1b0_0
jupyter_core              4.7.1            py38haa95532_0
jupyterlab_pygments       0.1.2                      py_0
libarchive                3.4.2                h5e25573_0
libiconv                  1.15                 h1df5818_7
liblief                   0.10.1               ha925a31_0
libpng                    1.6.37               h2a8f88b_0
libsodium                 1.0.18               h62dcd97_0
libtiff                   4.2.0                hd0e1b90_0
libxml2                   2.9.10               hb89e7f3_3
lz4-c                     1.9.3                h2bbff1b_0
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gmp                 6.1.0                         2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
markupsafe                2.0.1            py38h2bbff1b_0
matplotlib-inline         0.1.2                    pypi_0    pypi
menuinst                  1.4.16           py38he774522_1
mistune                   0.8.4           py38he774522_1000
msys2-conda-epoch         20160418                      1
navigator-updater         0.2.1                    py38_0
nbclient                  0.5.3              pyhd3eb1b0_0
nbconvert                 6.0.7                    py38_0
nbformat                  5.1.3              pyhd3eb1b0_0
nest-asyncio              1.5.1              pyhd3eb1b0_0
notebook                  6.4.0            py38haa95532_0
olefile                   0.46                       py_0
openssl                   1.1.1k               h2bbff1b_0
packaging                 20.9               pyhd3eb1b0_0
pandoc                    2.12                 haa95532_0
pandocfilters             1.4.3            py38haa95532_1
parso                     0.8.2              pyhd3eb1b0_0
pickleshare               0.7.5           pyhd3eb1b0_1003
pillow                    8.2.0            py38h4fa10fc_0
pip                       21.1.1           py38haa95532_0
pkginfo                   1.7.0            py38haa95532_0
powershell_shortcut       0.0.1                         3
prometheus_client         0.10.1             pyhd3eb1b0_0
prompt-toolkit            3.0.18                   pypi_0    pypi
psutil                    5.8.0            py38h2bbff1b_1
py-lief                   0.10.1           py38ha925a31_0
pycosat                   0.6.3            py38h2bbff1b_0
pycparser                 2.20                       py_2
pygments                  2.9.0              pyhd3eb1b0_0
pyopenssl                 20.0.1             pyhd3eb1b0_1
pyparsing                 2.4.7              pyhd3eb1b0_0
pyqt                      5.9.2            py38ha925a31_4
pyrsistent                0.17.3           py38he774522_0
pysocks                   1.7.1            py38haa95532_0
python                    3.8.8                hdbf39b2_5
python-dateutil           2.8.1              pyhd3eb1b0_0
python-libarchive-c       2.9                pyhd3eb1b0_1
pytz                      2021.1             pyhd3eb1b0_0
pywin32                   227              py38he774522_1
pywinpty                  0.5.7                    py38_0
pyyaml                    5.4.1            py38h2bbff1b_1
pyzmq                     20.0.0           py38hd77b12b_1
qt                        5.9.7            vc14h73c81de_0
qtpy                      1.9.0                      py_0
requests                  2.25.1             pyhd3eb1b0_0
ruamel-yaml               0.17.6                   pypi_0    pypi
ruamel-yaml-clib          0.2.2                    pypi_0    pypi
ruamel_yaml               0.15.100         py38h2bbff1b_0
send2trash                1.5.0              pyhd3eb1b0_1
setuptools                52.0.0           py38haa95532_0
sip                       4.19.13          py38ha925a31_0
six                       1.15.0           py38haa95532_0
soupsieve                 2.2.1              pyhd3eb1b0_0
sqlite                    3.35.4               h2bbff1b_0
terminado                 0.9.4            py38haa95532_0
testpath                  0.4.4              pyhd3eb1b0_0
tk                        8.6.10               he774522_0
tornado                   6.1                      pypi_0    pypi
tqdm                      4.59.0             pyhd3eb1b0_1
traitlets                 5.0.5              pyhd3eb1b0_0
urllib3                   1.26.4             pyhd3eb1b0_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wcwidth                   0.2.5                      py_0
webencodings              0.5.1                    py38_1
wheel                     0.36.2             pyhd3eb1b0_0
win_inet_pton             1.1.0            py38haa95532_0
wincertstore              0.2                      py38_0
winpty                    0.4.3                         4
xmltodict                 0.12.0                     py_0
xz                        5.2.5                h62dcd97_0
yaml                      0.2.5                he774522_0
zeromq                    4.3.3                ha925a31_3
zipp                      3.4.1              pyhd3eb1b0_0
zlib                      1.2.11               h62dcd97_4
zstd                      1.4.9                h19a0ad4_0

Does anyone has any idea how to fix this issue? I desperately want to use Jupyter Notebook on this computer.
Thank you for taking your time looking at this. Very appreciated!

I have encountered a similar problem, it is likely a problem with pyzmq

If you are using pip, try:

  • pip uninstall pyzmq
  • pip install pyzmq==19.0.2
  • restart jupyter

if you are using conda, try:

  • conda install pyzmq==19.0.2
  • restart jupyter

if you get an error message like ‘jupyter command not found’, try reinstalling jupyter

you can find more information about this issue here

Hope that helps solve your issue

2 Likes

I gave up on this problem sometime ago. But now, I can use Jupyter Notebook finally. Thank you so much sir!

1 Like

It shows this problem for me when I did this: AttributeError: ‘MSVCCompiler’ object has no attribute ‘_vcruntime_redist’
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyzmq
Running setup.py clean for pyzmq
Failed to build pyzmq
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyzmq)