Jupyter notebook cant connect the kernel

Jupyter notebook cannot connect to the kernel. I tried all the methods. I also reinstalled the computer system, reset the c drive, reinstalled anaconda, etc., but the same error was reported. I also changed the file path to Chinese, but Still fails, why? How to deal with it? The error is as follows: (the front part is the startup part, you can start to see it from the end, and the startup fails at the end)

[W 2022-12-11 19:23:10.102 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2022-12-11 19:23:10.102 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2022-12-11 19:23:10.111 LabApp] JupyterLab extension loaded from C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab
[I 2022-12-11 19:23:10.111 LabApp] JupyterLab application directory is C:\ProgramData\Anaconda3\share\jupyter\lab
[I 19:23:10.117 NotebookApp] Serving notebooks from local directory: C:\Users\dilim
[I 19:23:10.117 NotebookApp] Jupyter Notebook 6.4.12 is running at:
[I 19:23:10.117 NotebookApp] http://localhost:8888/?token=a2380da4760b3519ffd6c9e8bc15220404126807c6c4f538
[I 19:23:10.117 NotebookApp]  or http://127.0.0.1:8888/?token=a2380da4760b3519ffd6c9e8bc15220404126807c6c4f538
[I 19:23:10.117 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 19:23:10.149 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/dilim/AppData/Roaming/jupyter/runtime/nbserver-7544-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=a2380da4760b3519ffd6c9e8bc15220404126807c6c4f538
     or http://127.0.0.1:8888/?token=a2380da4760b3519ffd6c9e8bc15220404126807c6c4f538
[I 19:23:17.357 NotebookApp] Kernel started: 1474a909-0184-4cc9-995e-713135cea29f, name: python3
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 5, in <module>
    from .connect import *  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\connect.py", line 11, in <module>
    import jupyter_client
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\__init__.py", line 8, in <module>
    from .asynchronous import AsyncKernelClient  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\client.py", line 6, in <module>
    from jupyter_client.channels import HBChannel
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\channels.py", line 4, in <module>
    import asyncio
  File "C:\ProgramData\Anaconda3\lib\asyncio\__init__.py", line 8, in <module>
    from .base_events import *
  File "C:\ProgramData\Anaconda3\lib\asyncio\base_events.py", line 23, in <module>
    import socket
  File "C:\ProgramData\Anaconda3\lib\socket.py", line 54, in <module>
    import os, sys, io, selectors
  File "C:\ProgramData\Anaconda3\lib\selectors.py", line 12, in <module>
    import select
  File "C:\Users\dilim\Desktop\chooseexce\select.py", line 3, in <module>
    X = data=np.loadtxt("1.xlsx",delimiter=',',unpack=False)
  File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 1338, in loadtxt
    arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
  File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 999, in _read
    arr = _load_from_filelike(
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 50: illegal multibyte sequence
[I 19:23:20.341 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 5, in <module>
    from .connect import *  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\connect.py", line 11, in <module>
    import jupyter_client
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\__init__.py", line 8, in <module>
    from .asynchronous import AsyncKernelClient  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\client.py", line 6, in <module>
    from jupyter_client.channels import HBChannel
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\channels.py", line 4, in <module>
    import asyncio
  File "C:\ProgramData\Anaconda3\lib\asyncio\__init__.py", line 8, in <module>
    from .base_events import *
  File "C:\ProgramData\Anaconda3\lib\asyncio\base_events.py", line 23, in <module>
    import socket
  File "C:\ProgramData\Anaconda3\lib\socket.py", line 54, in <module>
    import os, sys, io, selectors
  File "C:\ProgramData\Anaconda3\lib\selectors.py", line 12, in <module>
    import select
  File "C:\Users\dilim\Desktop\chooseexce\select.py", line 3, in <module>
    X = data=np.loadtxt("1.xlsx",delimiter=',',unpack=False)
  File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 1338, in loadtxt
    arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
  File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 999, in _read
    arr = _load_from_filelike(
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 50: illegal multibyte sequence

You have a file called select.py which is shadowing the built-in select module.

Try moving/renaming that file, or perhaps more fruitfully, launching the underlying python process from a folder other than Desktop.

1 Like