我如何开始并构建一个jupyter笔记本

问题描述 投票:0回答:1

我正在尝试启动我的 AI 项目,需要构建一个 jupyter 笔记本。 我的步骤如下。

- 下载 Windows 版 anaconda(我以前没有使用过 python)
- 安装anaconda(因此将其注册为python 3.11)
- 从 pytorch.org 获取命令提示符并运行
- 打开 anaconda 提示符(尝试了用户和管理员)并输入“jupyter notebook”或“jupyter notebook --notebook-dir=D:\WorkPlace2\PyTorch”
  (文件夹打开没有错误)
- 我触发 new 并创建一个 *.ipynb 文件。
  然后出现“正在连接服务器”,很快就变成“未连接”

我在cmd中收到以下错误消息。

(base) C:\WINDOWS\system32>jupyter notebook --notebook-dir=D:\WorkPlace2\PyTorch

  _   _          _      _
 | | | |_ __  __| |__ _| |_ ___
 | |_| | '_ \/ _` / _` |  _/ -_)
  \___/| .__/\__,_\__,_|\__\___|
       |_|

Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.

https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html

Please note that updating to Notebook 7 might break some of your extensions.

[W 07:59:00.262 NotebookApp] Loading JupyterLab as a classic notebook (v6) extension.
[W 2024-02-22 07:59:00.262 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 2024-02-22 07:59:00.262 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 2024-02-22 07:59:00.278 LabApp] JupyterLab extension loaded from C:\Users\Elon\anaconda3\Lib\site-packages\jupyterlab
[I 2024-02-22 07:59:00.278 LabApp] JupyterLab application directory is C:\Users\Elon\anaconda3\share\jupyter\lab
[I 07:59:03.153 NotebookApp] Serving notebooks from local directory: D:\WorkPlace2\PyTorch
[I 07:59:03.153 NotebookApp] Jupyter Notebook 6.5.4 is running at:
[I 07:59:03.153 NotebookApp] http://localhost:8888/?token=924b87be561de5a84ea8a7caade9de736b0b813d2c4a7fa2
[I 07:59:03.153 NotebookApp]  or http://127.0.0.1:8888/?token=924b87be561de5a84ea8a7caade9de736b0b813d2c4a7fa2
[I 07:59:03.153 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 07:59:03.215 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/Elon/AppData/Roaming/jupyter/runtime/nbserver-6572-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=924b87be561de5a84ea8a7caade9de736b0b813d2c4a7fa2
     or http://127.0.0.1:8888/?token=924b87be561de5a84ea8a7caade9de736b0b813d2c4a7fa2
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
[I 07:59:11.053 NotebookApp] Kernel started: 6ad7a0f8-e1fc-4aaa-a62e-cc10f1aee0f1, name: python3
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
Exception in thread IOPub:
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
Traceback (most recent call last):
  File "C:\Users\Elon\anaconda3\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Users\Elon\anaconda3\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Elon\anaconda3\Lib\site-packages\ipykernel\iostream.py", line 85, in _thread_main
    self.io_loop.run_sync(_start_event_gc)
  File "C:\Users\Elon\anaconda3\Lib\site-packages\tornado\ioloop.py", line 521, in run_sync
    self.start()
  File "C:\Users\Elon\anaconda3\Lib\site-packages\tornado\platform\asyncio.py", line 195, in start
    self.asyncio_loop.run_forever()
  File "C:\Users\Elon\anaconda3\Lib\asyncio\base_events.py", line 607, in run_forever
    self._run_once()
  File "C:\Users\Elon\anaconda3\Lib\asyncio\base_events.py", line 1884, in _run_once
    event_list = self._selector.select(timeout)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Elon\anaconda3\Lib\selectors.py", line 323, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Elon\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
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Elon\anaconda3\Lib\site-packages\ipykernel_launcher.py", line 17, in <module>
    app.launch_new_instance()
  File "C:\Users\Elon\anaconda3\Lib\site-packages\traitlets\config\application.py", line 992, in launch_instance
    app.start()
  File "C:\Users\Elon\anaconda3\Lib\site-packages\ipykernel\kernelapp.py", line 723, in start
    self.kernel.start()
  File "C:\Users\Elon\anaconda3\Lib\site-packages\ipykernel\ipkernel.py", line 223, in start
    super().start()
  File "C:\Users\Elon\anaconda3\Lib\site-packages\ipykernel\kernelbase.py", line 553, in start
    asyncio.run_coroutine_threadsafe(self.poll_control_queue(), control_loop.asyncio_loop)
  File "C:\Users\Elon\anaconda3\Lib\asyncio\tasks.py", line 926, in run_coroutine_threadsafe
    loop.call_soon_threadsafe(callback)
  File "C:\Users\Elon\anaconda3\Lib\asyncio\base_events.py", line 806, in call_soon_threadsafe
    self._check_closed()
  File "C:\Users\Elon\anaconda3\Lib\asyncio\base_events.py", line 519, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[IPKernelApp] WARNING | Parent appears to have exited, shutting down.

我尝试卸载 anaconda 并重新启动系统并重新安装 anaconda。 但我无法解决这个问题。 在我重装系统之前,我尝试过这个,没有问题。 但现在,我找不到原因。

pytorch anaconda jupyter
1个回答
0
投票

我认为这是因为系统环境路径的原因。
如果您之前安装过其他与Python相关的程序,例如PyCharm,可能就是这个原因。
检查此处为什么(或为什么不)将 anaconda 添加到路径
如果您已经安装了 Pycharm,请尝试卸载 PyCharm 并重新安装 anaconda。
如果这不能解决您的问题,您甚至可以尝试重新安装 Windows 系统。

© www.soinside.com 2019 - 2024. All rights reserved.