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

使用Conda创建环境并添加至Jupyter-Lab时遇冻结模块警告

Conda环境添加至Jupyter-Lab的冻结模块警告处理

问题场景

通过Conda创建新环境testi2,执行命令ipython kernel install --user --name=testi2时出现冻结模块相关警告,命令输出如下:

$ ipython kernel install --user --name=testi2
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.
Installed kernelspec testi2 in /home/michael/.local/share/jupyter/kernels/testi2

环境与已做操作:

  • Python 3.11.0,Conda 22.11.0
  • 已安装包:ipykernel、ipython、ipywidgets、jupyterlab_widgets、ipympl
  • 已通过conda install nodejs -c conda-forge --repodata-fn=repodata.json安装最新版nodejs,尝试将ipykernel从6.20.1降级至6.19.2,警告仍存在

问题本质

该警告是Python 3.11新增的冻结模块特性与pydev调试器兼容性导致的提示,不影响kernel的正常安装和使用(从输出可见kernel已成功安装)。

解决方法

  1. 临时消除警告执行命令
    执行kernel安装命令时添加-Xfrozen_modules=off参数,改用python -m的规范方式调用:

    python -Xfrozen_modules=off -m ipykernel install --user --name=testi2
    
  2. 永久禁用该警告提示
    设置环境变量PYDEVD_DISABLE_FILE_VALIDATION=1:

    • 终端临时生效:
      export PYDEVD_DISABLE_FILE_VALIDATION=1
      
    • 永久生效(根据使用的shell选择配置文件):
      将上述命令添加到~/.bashrc(Bash)或~/.zshrc(Zsh)文件末尾,执行source ~/.bashrc或source ~/.zshrc使配置生效。
  3. 验证kernel可用性
    启动Jupyter Lab,在新建Notebook时选择testi2环境的kernel,运行简单代码(如print("test"))确认环境正常工作。

内容的提问来源于stack exchange,提问作者Elijah

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.05 01:20:46