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

无法在Jupyter Notebook中注册/访问/使用conda虚拟环境rideaux

Jupyter Notebook无法显示已注册的conda虚拟环境内核

问题描述

我有一个名为rideaux的conda虚拟环境,希望能在Jupyter Notebook中使用该环境,但Jupyter Notebook中仅显示默认内核,无其他可选内核。
Jupyter内核选择界面
我尝试导入该conda环境中已安装的包进行测试,当前可用内核无法完成导入。

已尝试的解决方案

  • 直接在rideaux环境内部启动Jupyter Notebook服务,内核列表无变化,仍未显示rideaux内核。
  • 尝试使用nb_conda_kernels包:在base环境和rideaux环境中均执行conda install -n notebook_env nb_conda_kernels完成安装,同时在rideaux环境中执行conda install ipykernel安装ipykernel,之后在rideaux环境中启动Notebook服务,内核列表仍无变化。
  • 尝试在rideaux环境中运行ipython kernel install --user --name=rideaux注册conda环境,操作后内核列表依旧无变化。

排查结果

  • 在rideaux环境中执行which jupyter,返回的是该环境内部的可执行文件路径。
  • 执行jupyter kernelspec list返回结果如下,其中python3对应截图中显示的默认内核:
Available kernels:
  rideaux    /home/mjpvanzuijlen/.local/share/jupyter/kernels/rideaux
  python3    /home/mjpvanzuijlen/anaconda3/envs/rideaux/share/jupyter/kernels/python3
  • 在Notebook内部执行!jupyter-troubleshoot返回结果如下,输出中未提及rideaux环境,也没有此前which jupyter返回的可执行文件路径:
$PATH:
    /snap/jupyter/6/bin
    /snap/jupyter/6/usr/sbin
    /snap/jupyter/6/usr/bin
    /snap/jupyter/6/sbin
    /snap/jupyter/6/bin
    /home/mjpvanzuijlen/snap/jupyter/common/bin
    /usr/local/sbin
    /usr/local/bin
    /usr/sbin
    /usr/bin
    /sbin
    /bin
    /usr/games
    /usr/local/games

sys.path:
    /snap/jupyter/6/bin
    /snap/jupyter/6/lib/python37.zip
    /snap/jupyter/6/lib/python3.7
    /snap/jupyter/6/lib/python3.7/lib-dynload
    /snap/jupyter/6/lib/python3.7/site-packages

sys.executable:
    /snap/jupyter/6/bin/python3.7

sys.version:
    3.7.3 | packaged by conda-forge | (default, Mar 27 2019, 23:01:00) 
    [GCC 7.3.0]

platform.platform():
    Linux-4.15.0-140-generic-x86_64-with-glibc2.10

which -a jupyter:
    /snap/jupyter/6/bin/jupyter
    /snap/jupyter/6/bin/jupyter

解决方案

根因

设备上通过snap安装的Jupyter优先级高于conda虚拟环境内的Jupyter,即使激活rideaux环境后启动Jupyter,实际运行的还是全局snap版本的Jupyter,该版本无法读取conda环境下的内核配置,导致已注册的rideaux内核不显示。

操作步骤

  1. 卸载snap版本的Jupyter:
sudo snap remove jupyter
  1. 重新激活rideaux conda环境:
conda activate rideaux
  1. 验证当前Jupyter路径属于rideaux环境:
which jupyter

返回路径为/home/mjpvanzuijlen/anaconda3/envs/rideaux/bin/jupyter一类的conda环境内路径即为正常。
4. 启动Jupyter Notebook,此时内核列表即可正常显示rideaux选项。

如果需要保留snap版本的Jupyter,也可以在激活rideaux环境后,使用完整路径调用环境内的Jupyter:

/home/mjpvanzuijlen/anaconda3/envs/rideaux/bin/jupyter notebook

内容的提问来源于stack exchange,提问作者Mitchell van Zuylen

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.05 14:36:04