首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用AttributeError处理Github操作中的纸厂运行错误

用AttributeError处理Github操作中的纸厂运行错误
EN

Stack Overflow用户
提问于 2022-01-30 23:53:08
回答 1查看 450关注 0票数 2

我正在运行我的,作为我的GitHub操作CI的一部分,它工作了相当一段时间。但今天,它不再抱怨这个错误:

代码语言:javascript
复制
Input Notebook:  03_Pcap.ipynb
Output Notebook: /tmp/ipynb/03_Pcap.ipynb
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ipython_genutils/ipstruct.py", line 132, in __getattr__
    result = self[key]
KeyError: 'language'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/bin/papermill", line 8, in <module>
    sys.exit(papermill())
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/cli.py", line 242, in papermill
    execute_notebook(
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/execute.py", line 81, in execute_notebook
    nb = parameterize_notebook(nb, parameters, report_mode)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/parameterize.py", line 75, in parameterize_notebook
    language = nb.metadata.kernelspec.language
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ipython_genutils/ipstruct.py", line 134, in __getattr__
    raise AttributeError(key)
AttributeError: language
  1. 在这段时间里,我没有改变任何事情:https://github.com/DSPJ2021/syncmesh/compare/e97b1ced4ae90e27c7eb653dc27602edd9be81fa...1bdd32aefa621249a6d6223854d2c41f494da2d1 不过,它还是停止了工作:最后的工作行动 / 首次失败行动
  2. 我已经比较了工人版本,两者都是2.286.1
  3. 我比较了已安装的python版本,两者都是3.10.2
  4. 我比较了已安装的依赖项,但大多数都是相同的。(工作中 / 失足)
代码语言:javascript
复制
- papermill is the same version (2.3.3)
- papermill-nb-runner is the same (1.1.16)
- ipykernel is the same (6.7.0)
- nbformat is the same (5.1.3)
- nbconvert is the same (6.4.1)
  1. 我跟踪了语言错误并解析了它(提交) (动作运行),但是直接进入了下一个:
代码语言:javascript
复制
Input Notebook:  03_Pcap.ipynb
Output Notebook: /tmp/ipynb/03_Pcap.ipynb
Input notebook does not contain a cell with tag 'parameters'

Executing:   0%|          | 0/27 [00:00<?, ?cell/s]Notebook JSON is invalid: Additional properties are not allowed ('id' was unexpected)

Failed validating 'additionalProperties' in code_cell:

On instance['cells'][0]:
{'cell_type': 'code',
 'execution_count': None,
 'id': '4e48dff5',
 'metadata': {'papermill': {'duration': None,
                            'end_time': None,
                            'exception': None,
                            'start_time': None,
                            'status': 'pending'},
              'tags': ['injected-parameters']},
 'outputs': ['...0 outputs...'],
 'source': '# Parameters\n'
           '( = ["\'", "c", "i", "\'", ",", " ", "\'", "t", "r", "...'}

Executing:   0%|          | 0/27 [00:00<?, ?cell/s]
Notebook JSON is invalid: Additional properties are not allowed ('id' was unexpected)

Failed validating 'additionalProperties' in code_cell:

On instance['cells'][0]:
{'cell_type': 'code',
 'execution_count': None,
 'id': '4e48dff5',
 'metadata': {'papermill': {'duration': None,
                            'end_time': None,
                            'exception': None,
                            'start_time': None,
                            'status': 'completed'},
              'tags': ['injected-parameters']},
 'outputs': ['...0 outputs...'],
 'source': '# Parameters\n'
           '( = ["\'", "c", "i", "\'", ",", " ", "\'", "t", "r", "...'}
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/bin/papermill", line 8, in <module>
    sys.exit(papermill())
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/cli.py", line 242, in papermill
    execute_notebook(
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/execute.py", line 91, in execute_notebook
    nb = papermill_engines.execute_notebook_with_engine(
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/engines.py", line 49, in execute_notebook_with_engine
    return self.get_engine(engine_name).execute_notebook(nb, kernel_name, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/engines.py", line 310, in execute_notebook
    nb = cls.execute_managed_notebook(nb_man, kernel_name, log_output=log_output, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/engines.py", line 372, in execute_managed_notebook
    preprocessor.preprocess(nb_man, safe_kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/preprocess.py", line 20, in preprocess
    with self.setup_preprocessor(nb_man.nb, resources, km=km):
AttributeError: 'PapermillExecutePreprocessor' object has no attribute 'setup_preprocessor'
Error: Process completed with exit code 1.
  1. 查找错误并发现:
代码语言:javascript
复制
- this [issue](https://github.com/mwouts/jupytext/issues/764). But I am already using a more recent version than in the issue (`nbformat>=5.1.0`)
- another [issue](https://github.com/nteract/papermill/issues/362). But I also use a more recent version of `nbconvert>= 5.5`
- this [unresolved issue](https://github.com/yaananth/run-notebook/issues/11)
- [this also looks related](https://github.com/nteract/papermill/issues/568)
  1. 更新我的.ipynpb版本后(从4.2到4.5)。我只能说是这个错误:
代码语言:javascript
复制
Input Notebook:  03_Pcap.ipynb
Output Notebook: /tmp/ipynb/03_Pcap.ipynb
Input notebook does not contain a cell with tag 'parameters'

Executing:   0%|          | 0/27 [00:00<?, ?cell/s]
Executing:   0%|          | 0/27 [00:00<?, ?cell/s]
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.2/x64/bin/papermill", line 8, in <module>
    sys.exit(papermill())
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/cli.py", line 242, in papermill
    execute_notebook(
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/execute.py", line 91, in execute_notebook
    nb = papermill_engines.execute_notebook_with_engine(
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/engines.py", line 49, in execute_notebook_with_engine
    return self.get_engine(engine_name).execute_notebook(nb, kernel_name, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/engines.py", line 310, in execute_notebook
    nb = cls.execute_managed_notebook(nb_man, kernel_name, log_output=log_output, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/engines.py", line 372, in execute_managed_notebook
    preprocessor.preprocess(nb_man, safe_kwargs)
  File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/papermill/preprocess.py", line 20, in preprocess
    with self.setup_preprocessor(nb_man.nb, resources, km=km):
AttributeError: 'PapermillExecutePreprocessor' object has no attribute 'setup_preprocessor'

谁知道哪里出了问题,怎么让它再起作用?

顺便说一句:它在我的机器上工作得很好。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-01-31 15:43:30

复杂的问题简单解决方案:我的requirements.txt引用了一个名为papermill-nb-runner、安装它(和papermill)的旧包,pip不知怎么搞错了,安装了旧版本的papermill,但只显示了最新版本。

解决办法是去除papermill-nb-runner

而且,它只是通过pip:https://github.com/pypa/pip/issues/10861中的一个bug来突出显示。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70920016

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档