【问题标题】:ERROR: jupyter_client.kernelspec.NoSuchKernel: No such kernel named python3 occurs in Airflow/papermill running as a docker container错误:jupyter_client.kernelspec.NoSuchKernel:在作为 docker 容器运行的 Airflow/papermill 中没有出现名为 python3 的内核
【发布时间】:2021-12-13 23:11:38
【问题描述】:

我正在尝试运行一个示例 papermill 笔记本,您可以在官方 Apache Airflow url 上找到 here

airflow-github

带有对应的 dag 文件,位于与上述相同的目录中。

我使用 docker-compose 程序集在本地运行此程序,您可以在 Airflow 网站上找到 here

airflow-docker-page

我不得不使用 Papermill 自定义构建图像,因为它看起来没有被烘焙到图像中:

enter image description here

这是我遇到的一个错误:

raise NoSuchKernel(kernel_name)

jupyter_client.kernelspec.NoSuchKernel:没有名为 python3 的内核

如何添加内核?

更新: 我设法解决了这个问题,但现在有了这个:

[2021-10-28, 22:47:57 UTC] {execute.py:84} INFO - 输入笔记本:/opt//dags/example_notebook.ipynb [2021-10-28, 22:47:57 UTC] {execute.py:85} INFO - 输出笔记本:out-2021-10-28T22:47:55.826195+00:00.ipynb [2021-10-28, 22:47:57 UTC] {driver.py:192} INFO - 从 /home//.local/lib/python3.6/site- 生成语法表包/blib2to3/Grammar.txt [2021-10-28, 22:47:57 UTC] {driver.py:195} INFO - 将语法表写入 /home//.cache/black/21.9b0/Grammar3.6.15.final .0.pickle [2021-10-28, 22:47:57 UTC] {driver.py:199} INFO - 写入失败:[Errno 2] 没有这样的文件或目录:'/home/airflow/.cache/black/21.9b0/ tmp27kcm8y_' [2021-10-28, 22:47:57 UTC] {driver.py:192} INFO - 从 /home//.local/lib/python3.6/site- 生成语法表包/blib2to3/PatternGrammar.txt [2021-10-28, 22:47:57 UTC] {driver.py:195} INFO - 将语法表写入 /home//.cache/black/21.9b0/PatternGrammar3.6.15.final .0.pickle [2021-10-28, 22:47:57 UTC] {driver.py:199} INFO - 写入失败:[Errno 2] 没有这样的文件或目录:'/home/airflow/.cache/black/21.9b0/ tmpnexc_sob' [2021-10-28, 22:47:57 UTC] {warnings.py:99} 警告 - /home//.local/lib/python3.6/site-packages/IPython/ path.py:67: UserWarning: IPython parent '/home/***' 不是可写位置,使用临时目录。 " 使用临时目录。".format(parent))

【问题讨论】:

    标签: kernel airflow jupyter papermill


    【解决方案1】:

    我和你有同样的问题,

    我通过在 Docker 文件中添加行来解决它

    RUN pip install --upgrade pip ipython ipykernel
    RUN ipython kernel install --name "python3" --user
    

    然后

    docker-compose build
    docker-compose up
    

    这是我的完整 Dockerfile

    FROM apache/airflow:2.2.1   
    COPY requirement.txt .   
    RUN pip install -r requirement.txt
    RUN pip install --upgrade pip ipython ipykernel   
    RUN ipython kernel install --name "python3" --user
    CMD python -m ipykernel_launcher -f $DOCKERNEL_CONNECTION_FILE
    

    【讨论】:

      猜你喜欢
      • 2023-03-30
      • 2016-11-10
      • 2022-01-12
      • 2021-02-02
      • 2023-01-04
      • 2019-12-04
      • 1970-01-01
      • 1970-01-01
      • 2021-05-24
      相关资源
      最近更新 更多