python jupyter nbconvert不能在snakemake -use-conda创建的环境中工作

czfnxgou  于 2023-01-16  发布在  Python
关注(0)|答案(1)|浏览(186)

我在这个问题上纠缠了好几天。
我创建了如下环境envs/jupyter.yaml

channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - libgcc-ng=12.2.0
  - libblas=3.9.0
  - liblapack=3.9.0
  - notebook=6.5.2
  - r-base=4.2.1
  - r-tidyverse=1.3.2
  - bioconductor-complexheatmap=2.14.0
  - bioconductor-biostrings=2.66.0
  - r-irkernel=1.3.1
  - jupyter_contrib_nbextensions=0.7.0
  - biopython=1.74
  - scipy=1.10.0

snakefile规则看起来像

rules stat:
    conda: 'envs/jupyter.yaml'
    notebook: rules.notebook.output.stat

当我运行“snakemake --use-conda”时,错误

Activating conda environment: .snakemake/conda/dd29012628c49c75d6a5c31f75898e03
Traceback (most recent call last):
  File "/share/home/sibyl/bak/sars2_surveillance/.snakemake/conda/dd29012628c49c75d6a5c31f75898e03/bin/jupyter-nbconvert", line 6, in <module>
    from nbconvert.nbconvertapp import main
  File "/share/home/sibyl/bak/sars2_surveillance/.snakemake/conda/dd29012628c49c75d6a5c31f75898e03/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 185, in <module>
    class NbConvertApp(JupyterApp):
  File "/share/home/sibyl/bak/sars2_surveillance/.snakemake/conda/dd29012628c49c75d6a5c31f75898e03/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 278, in NbConvertApp
    formats=get_export_names()
  File "/share/home/sibyl/bak/sars2_surveillance/.snakemake/conda/dd29012628c49c75d6a5c31f75898e03/lib/python3.8/site-packages/nbconvert/exporters/base.py", line 137, in get_export_names
    exporters = sorted(e.name for e in entry_points(group="nbconvert.exporters"))
TypeError: entry_points() got an unexpected keyword argument 'group'

RuleException:
CalledProcessError in file /share/home/sibyl/bak/sars2_surveillance/Snakefile, line 310:
Command 'source /share/home/sibyl/miniconda3/envs/sars2/bin/activate '/share/home/sibyl/bak/sars2_surveillance/.snakemake/conda/dd29012628c49c75d6a5c31f75898e03'; set -euo pipefail;  jupyter-nbconvert --log-level ERROR --execute --output /share/home/sibyl/bak/sars2_surveillance/test/output/0log/upstream_stat/test.r.ipynb --to notebook --ExecutePreprocessor.timeout=-1 /share/home/sibyl/bak/sars2_surveillance/.snakemake/scripts/tmpcnlnf1wn.upstream_stat.r.ipynb' returned non-zero exit status 1.
  File "/share/home/sibyl/bak/sars2_surveillance/Snakefile", line 310, in __rule_upstream_stat
  File "/share/home/sibyl/miniconda3/envs/sars2/lib/python3.11/concurrent/futures/thread.py", line 58, in run

我的nbconvert版本

- nbconvert=7.2.7=pyhd8ed1ab_0
  - nbconvert-core=7.2.7=pyhd8ed1ab_0
  - nbconvert-pandoc=7.2.7=pyhd8ed1ab_0

当我进入虚拟环境dd 29012628 c49 c75 d 6a 5c 31 f75898 e03时,命令'jupyter nbconvert'像以前一样返回TypeError,即使在我重新安装nbconvert之后。我还尝试安装nbconvert v7.1.0。同样的错误。
几天前一切都很完美。真的需要帮助!非常感谢。

eeq64g8w

eeq64g8w1#

这似乎是与markdown相关的问题,请参见this thread以了解相关讨论。
一种解决方案是向yaml添加显式markdown版本:

channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - markdown==3.3.4
# the rest of dependencies listed

相关问题