Jupyter Lab切换文件时冻结崩溃,求助解决方法
问题详情
环境信息
- 系统:MacBook Pro Sonoma
- Python版本:3.11
- Jupyter Lab版本:3.6.2
- 使用时长:1年
异常症状
- 启动后仅能正常输入约1分钟
- 切换文件夹时直接崩溃
- 操作过程中卡顿严重
已尝试的解决措施
- 通过
pip install certifi更新SSL证书 - 在终端设置
-Xfrozen_modules=off并重启虚拟环境
终端启动日志
➜ data-analysis source .venv/bin/activate (.venv) ➜ data-analysis jupyter lab [I 2023-12-04 05:50:50.660 ServerApp] Package jupyterlab took 0.0000s to import [I 2023-12-04 05:50:50.665 ServerApp] Package jupyter_server_fileid took 0.0045s to import [I 2023-12-04 05:50:50.675 ServerApp] Package jupyter_server_terminals took 0.0097s to import [I 2023-12-04 05:50:50.724 ServerApp] Package jupyter_server_ydoc took 0.0484s to import [I 2023-12-04 05:50:50.724 ServerApp] Package nbclassic took 0.0000s to import [W 2023-12-04 05:50:50.727 ServerApp] A _jupyter_server_extension_points function was not found in nbclassic. 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 2023-12-04 05:50:50.727 ServerApp] Package notebook_shim took 0.0000s to import [W 2023-12-04 05:50:50.727 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 2023-12-04 05:50:50.732 ServerApp] jupyter_server_fileid | extension was successfully linked. [I 2023-12-04 05:50:50.735 ServerApp] jupyter_server_terminals | extension was successfully linked. [I 2023-12-04 05:50:50.739 ServerApp] jupyter_server_ydoc | extension was successfully linked. [I 2023-12-04 05:50:50.743 ServerApp] jupyterlab | extension was successfully linked. [I 2023-12-04 05:50:50.747 ServerApp] nbclassic | extension was successfully linked. [I 2023-12-04 05:50:51.101 ServerApp] notebook_shim | extension was successfully linked. [I 2023-12-04 05:50:51.428 ServerApp] notebook_shim | extension was successfully loaded. [I 2023-12-04 05:50:51.428 FileIdExtension] Configured File ID manager: ArbitraryFileIdManager [I 2023-12-04 05:50:51.428 FileIdExtension] [I 2023-12-04 05:50:51.429 FileIdExtension] [I 2023-12-04 05:50:51.431 FileIdExtension] ArbitraryFileIdManager : Successfully connected to database file. [I 2023-12-04 05:50:51.432 FileIdExtension] ArbitraryFileIdManager : Creating File ID tables and indices with journal_mode = DELETE [I 2023-12-04 05:50:51.435 FileIdExtension] Attached event listeners. [I 2023-12-04 05:50:51.435 ServerApp] jupyter_server_fileid | extension was successfully loaded. [I 2023-12-04 05:50:51.437 ServerApp] jupyter_server_terminals | extension was successfully loaded. [I 2023-12-04 05:50:51.437 ServerApp] jupyter_server_ydoc | extension was successfully loaded. [I 2023-12-04 05:50:51.438 LabApp] JupyterLab extension loaded from analysis/.venv/lib/python3.11/site-packages/jupyterlab [I 2023-12-04 05:50:51.438 LabApp] JupyterLab application directory is /Users//Desktop/Python/data-analysis/.venv/share/jupyter/lab [I 2023-12-04 05:50:51.441 ServerApp] jupyterlab | extension was successfully loaded. [I 2023-12-04 05:50:51.448 ServerApp] nbclassic | extension was successfully loaded. [I 2023-12-04 05:50:51.449 ServerApp] Serving notebooks from local directory: 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. [I 2023-12-04 05:50:55.257 LabApp] Build is up to date [W 2023-12-04 05:50:56.558 ServerApp] SSL Error on 22 (‘2606:50c0:8000::153’, 443, 0, 0): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992) [I
解决建议
1. 彻底修复Mac SSL证书问题
Mac Sonoma下Python SSL证书易出异常,执行以下操作:
- 打开
/Applications/Python 3.11/Install Certificates.command文件,运行完成证书安装 - 在Python环境中执行
import certifi; print(certifi.where()),确认证书路径指向虚拟环境内的文件
2. 重置Jupyter Lab配置
- 备份现有配置:用
jupyter lab config list查看配置路径,复制保存原配置文件 - 重置配置:执行
jupyter lab --generate-config覆盖现有配置,或直接删除旧配置文件 - 启动时添加
jupyter lab --no-extensions参数,禁用所有第三方扩展,测试是否因扩展冲突导致问题
3. 更新或重装Jupyter组件
- 更新核心组件:
pip install --upgrade jupyterlab jupyter_server - 若更新无效,完全卸载后重装:
pip uninstall -y jupyterlab jupyter_server nbclassic notebook_shim pip install jupyterlab
4. 重建虚拟环境
- 执行以下步骤重新创建干净的虚拟环境:
deactivate rm -rf .venv python3.11 -m venv .venv source .venv/bin/activate pip install jupyterlab - 测试基础环境下Jupyter Lab的运行状态
内容的提问来源于stack exchange,提问作者Cassandra
相关产品推荐
相关产品推荐

