Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

IPyKernel throws cannot import name write_connection_file

未关闭
#967 6 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
devtools

调研方向

从 ipykernel/init.py 和 ipykernel/connect.py 开始,然后检查 traceback 中显示的 jupyter_client/init.py 导入路径。使用列出的 Python、ipykernel 和 jupyter-client 版本重现 python -m ipykernel install --user --name=myenv。当命令在没有导入错误的情况下完成,并且 coverage 覆盖兼容的导入行为时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Name: ipykernel
Version: 6.15.1

On Apple M1 Pro Mac. OS: Monterey 12.3

On Python 3.9.13 with the following versions, IPyKernel fails "python -m ipykernel install --user --name=myenv"

jupyter               1.0.0
jupyter-client        7.3.4
jupyter-console       6.4.4
jupyter-core          4.11.1
jupyterlab-pygments   0.2.2
jupyterlab-widgets    1.1.1

Stack Trace:

[REMOVED]lib/python3.9/site-packages/jupyter_client/__init__.py:23: UserWarning: Could not import submodules
  warnings.warn("Could not import submodules")
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "[REMOVED]lib/python3.9/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
  File "[REMOVED]/lib/python3.9/site-packages/ipykernel/connect.py", line 12, in <module>
    from jupyter_client import write_connection_file
ImportError: cannot import name 'write_connection_file' from 'jupyter_client' ([REMOVED]/lib/python3.9/site-packages/jupyter_client/__init__.py)
主要语言
Python
星标
734
派生
411
平均合并
1 天 2 小时
30 天内合并 PR
9

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ipython/ipykernel 的其他 Issue

查看 ipython/ipykernel 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。