当前位置: 首页 > article >正文

解决 PyCharm 无法启动 Jupyter 服务器的问题:报错分析与解决方案

文章目录

    • 报错背景
    • 报错详细信息
    • 解决方案
      • pycharm 设置

报错背景

在使用 pycharm 付费版的过程中,发现一直无法启动 jupyter 服务器。
一直也不知道是为什么,直到在终端输入:

jupyter notebook

发现 jupyter 服务无法启动。

报错详细信息

下述是我运行 jupyter notebook 命令后的报错信息。

[I 2024-09-14 15:51:53.496 ServerApp] Package notebook took 0.0000s to import
[I 2024-09-14 15:51:53.499 ServerApp] Package jupyter_lsp took 0.0030s to import
[W 2024-09-14 15:51:53.499 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2024-09-14 15:51:53.501 ServerApp] Package jupyter_server_terminals took 0.0013s to import
[I 2024-09-14 15:51:53.501 ServerApp] Package jupyterlab took 0.0000s to import
Fail to get yarn configuration. internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'worker_threads'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at /home/jie/anaconda3/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:423:2576
    at Object.<anonymous> (/home/jie/anaconda3/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:743:8770)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

[I 2024-09-14 15:51:53.635 ServerApp] Package notebook_shim took 0.0000s to import
[W 2024-09-14 15:51:53.635 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2024-09-14 15:51:53.880 ServerApp] Package panel.io.jupyter_server_extension took 0.2448s to import
[I 2024-09-14 15:51:53.880 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-09-14 15:51:53.881 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-09-14 15:51:53.882 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-09-14 15:51:53.884 ServerApp] notebook | extension was successfully linked.
[I 2024-09-14 15:51:53.968 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-09-14 15:51:53.968 ServerApp] panel.io.jupyter_server_extension | extension was successfully linked.
[I 2024-09-14 15:51:53.973 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-09-14 15:51:53.973 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-09-14 15:51:53.974 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-09-14 15:51:53.974 LabApp] JupyterLab extension loaded from /home/jie/anaconda3/lib/python3.11/site-packages/jupyterlab
[I 2024-09-14 15:51:53.974 LabApp] JupyterLab application directory is /home/jie/anaconda3/share/jupyter/lab
[I 2024-09-14 15:51:53.974 LabApp] Extension Manager is 'pypi'.
[I 2024-09-14 15:51:53.975 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-09-14 15:51:53.976 ServerApp] notebook | extension was successfully loaded.
[I 2024-09-14 15:51:53.976 ServerApp] panel.io.jupyter_server_extension | extension was successfully loaded.
[I 2024-09-14 15:51:53.976 ServerApp] The port 8888 is already in use, trying another port.
Traceback (most recent call last):
  File "/home/jie/anaconda3/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/jie/anaconda3/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 618, in launch_instance
    serverapp = cls.initialize_server(argv=args)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jie/anaconda3/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 588, in initialize_server
    serverapp.initialize(
  File "/home/jie/anaconda3/lib/python3.11/site-packages/traitlets/config/application.py", line 113, in inner
    return method(app, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jie/anaconda3/lib/python3.11/site-packages/jupyter_server/serverapp.py", line 2609, in initialize
    self.init_httpserver()
  File "/home/jie/anaconda3/lib/python3.11/site-packages/jupyter_server/serverapp.py", line 2432, in init_httpserver
    self._find_http_port()
  File "/home/jie/anaconda3/lib/python3.11/site-packages/jupyter_server/serverapp.py", line 2479, in _find_http_port
    sockets = bind_sockets(port, self.ip)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jie/anaconda3/lib/python3.11/site-packages/tornado/netutil.py", line 162, in bind_sockets
    sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address

解决方案

通过指定 --ip后,发现程序已可成功运行。

jupyter notebook --ip=127.0.0.1

pycharm 设置

在这里插入图片描述
在pycharm jupyter 的设置中,设置:

notebook --no-browser --ip=127.0.0.1

在这里插入图片描述

然后, pycharm 就可以运行 jupyter .ipynb 文件。

在这里插入图片描述


http://www.kler.cn/a/304517.html

相关文章:

  • linux上海康SDK安装并设置环境变量
  • 【Java语言】String类
  • 【C语言】值传递和地址传递
  • ubuntu连接orangepi-zero-2w桌面的几种方法
  • flutter下拉刷新上拉加载的简单实现方式三
  • 【121. 买卖股票的最佳时机】——贪心算法/动态规划
  • AI问答-HTTP:理解 Content-Disposition
  • 如何用idea连接hadoop
  • 【.NET全栈】ASP.NET开发Web应用——成员和角色管理技术
  • 一分钟了解小程序的等保测评
  • PHP全程可视化防伪溯源一体化管理系统小程序源码
  • 64位整数乘法
  • 【App】React Native
  • SQLite的入门级项目学习记录(二)
  • 汽车租赁系统1.0版本
  • Linux——进程状态
  • 【React Native】第三方组件
  • 前端层面----监控与埋点
  • EasyExcel拿表头(二级表头)爬坑,invokeHeadMap方法
  • 记录一下,Vcenter清理/storage/archive空间
  • kafka 之 本地部署单机版
  • spring项目期间的学习9/11
  • 《论企业集成平台的技术与应用》写作框架,软考高级系统架构设计师
  • 数据库系统 第58节 数据库审计
  • 创意无限:五款AI绘画应用,让艺术创作更简单
  • Java基础 --- 多线程JUC,以及一些常用的设计模式总结