You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Anaconda环境下Jupyter Lab/Notebook启动失败求助

Jupyter Lab/Notebook启动失败的解决办法

核心报错分析

启动日志里存在两类关键问题:

  1. 权限拒绝错误:无法写入Jupyter runtime目录下的文件(如notebook_cookie_secret、nbserver-xxx.json)
  2. 版本兼容性冲突:
    • jupyter_lsp扩展调用了NotebookApp不存在的io_loop属性
    • jupyterlab扩展调用了NotebookApp不存在的identity_provider属性
    • nbdime扩展要求Jupyter Server v1,但当前安装的是v2.14.1

报错日志原文:

[I 14:43:12.768 NotebookApp] Writing notebook server cookie secret to C:\Users\...\AppData\Roaming\jupyter\runtime\notebook_cookie_secret  
[E 14:43:12.768 NotebookApp] Failed to write cookie secret to C:\Users\...\AppData\Roaming\jupyter\runtime\notebook_cookie_secret: [Errno 13] Permission denied: 'C:\\Users\\...\\AppData\\Roaming\\jupyter\\runtime\\notebook_cookie_secret'  
[W 14:43:12.769 NotebookApp] Could not set permissions on C:\Users\...\AppData\Roaming\jupyter\runtime\notebook_cookie_secret  
[W 14:43:13.159 NotebookApp] Error loading server extension jupyter_lsp  
Traceback (most recent call last):  
File "C:\ProgramData\anaconda3\Lib\site-packages\notebook\notebookapp.py", line 2050, in init_server_extensions  
func(self)  
File "C:\ProgramData\anaconda3\Lib\site-packages\jupyter_lsp\serverextension.py", line 76, in load_jupyter_server_extension  
nbapp.io_loop.call_later(0, initialize, nbapp, virtual_documents_uri)  
^^^^^^^^^^^^^  
AttributeError: 'NotebookApp' object has no attribute 'io_loop'  
[W 14:43:14.566 NotebookApp] Error loading server extension jupyterlab  
Traceback (most recent call last):  
File "C:\ProgramData\anaconda3\Lib\site-packages\notebook\notebookapp.py", line 2050, in init_server_extensions  
func(self)  
File "C:\ProgramData\anaconda3\Lib\site-packages\jupyterlab\serverextension.py", line 71, in load_jupyter_server_extension  
extension.initialize()  
File "C:\ProgramData\anaconda3\Lib\site-packages\jupyterlab\labapp.py", line 923, in initialize  
super().initialize()  
File "C:\ProgramData\anaconda3\Lib\site-packages\jupyter_server\extension\application.py", line 437, in initialize  
self._prepare_handlers()  
File "C:\ProgramData\anaconda3\Lib\site-packages\jupyter_server\extension\application.py", line 327, in _prepare_handlers  
self.initialize_handlers()  
File "C:\ProgramData\anaconda3\Lib\site-packages\jupyterlab\labapp.py", line 737, in initialize_handlers  
page_config["token"] = self.serverapp.identity_provider.token  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
AttributeError: 'NotebookApp' object has no attribute 'identity_provider'  
[I 14:43:14.588 NotebookApp] Registered jupyterlab_code_formatter server extension  
[I 14:43:14.674 NotebookApp] [Jupytext Server Extension] Deriving a JupytextContentsManager from LargeFileManager  
[C 14:43:14.822 NotebookApp] You must use Jupyter Server v1 to load nbdime as a classic notebook server extension. You have v2.14.1 installed.  
You can fix this by executing:  
pip install -U "jupyter-server[I 14:43:14.825 NotebookApp] Serving notebooks from local directory: C:\Users\...
[I 14:43:14.825 NotebookApp] Jupyter Notebook 6.5.7 is running at:  
[I 14:43:14.825 NotebookApp] http://localhost:8888/?token=ea4415adbb582389279d62b9cdeefbfbc8b63dc805c2a923  
[I 14:43:14.825 NotebookApp] or http://127.0.0.1:8888/?token=ea4415adbb582389279d62b9cdeefbfbc8b63dc805c2a923  
[I 14:43:14.825 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).  
[E 14:43:14.825 NotebookApp] Failed to write server-info to C:\Users\...\AppData\Roaming\jupyter\runtime\nbserver-4160.json: [Errno 13] Permission denied: 'C:\\Users\\...\\AppData\\Roaming\\jupyter\\runtime\\nbserver-4160.json'  
Traceback (most recent call last):  
File "C:\ProgramData\anaconda3\Scripts\jupyter-notebook-script.py", line 9, in  
sys.exit(main())  
^^^^^^  
File "C:\ProgramData\anaconda3\Lib\site-packages\jupyter_core\application.py", line 283, in launch_instance  
super().launch_instance(argv=argv, **kwargs)  
File "C:\ProgramData\anaconda3\Lib\site-packages\traitlets\config\application.py", line 1075, in launch_instance  
app.start()  
File "C:\ProgramData\anaconda3\Lib\site-packages\notebook\notebookapp.py", line 2358, in start  
self.write_browser_open_file()  
File "C:\ProgramData\anaconda3\Lib\site-packages\notebook\notebookapp.py", line 2261, in write_browser_open_file  
with open(self.browser_open_file, 'w', encoding='utf-8') as f:  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\...\\AppData\\Roaming\\jupyter\\runtime\\nbserver-4160-open.html'

分步解决方案

1. 解决权限问题

  • 方式一:直接以管理员身份打开Anaconda Prompt,再尝试启动Jupyter
  • 方式二:修改Jupyter runtime目录权限
    1. 打开文件资源管理器,定位到C:\Users\你的用户名\AppData\Roaming\jupyter\runtime(若看不到AppData,先开启「显示隐藏文件」)
    2. 右键该文件夹,选择「属性」→「安全」→「编辑」
    3. 选中当前用户,勾选「完全控制」权限,点击「确定」保存

2. 修复版本兼容性冲突

方案A:升级Notebook到兼容Jupyter Server v2的版本

旧版Notebook 6.5.7不支持Jupyter Server v2的新API,执行以下命令升级:

pip install --upgrade notebook

之后升级相关扩展以适配新版本:

pip install --upgrade jupyter-lsp jupyterlab nbdime

方案B:降级Jupyter Server到v1版本(适配旧版Notebook)

若不想升级Notebook,可降级Jupyter Server到v1的稳定版本:

pip install jupyter-server==1.24.0

再重新安装适配v1的扩展:

pip install --upgrade jupyter-lsp jupyterlab nbdime

3. 验证启动

  1. 激活你的Anaconda环境(若使用了虚拟环境):
conda activate 你的环境名称
  1. 启动Jupyter Notebook:
jupyter notebook

或者启动Jupyter Lab:

jupyter lab

内容的提问来源于stack exchange,提问作者Al'a Salah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 01:23:12