Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while building Tribler documentation: module 'mistune' has no attribute 'BlockGrammar' #6624

Closed
kozlovsky opened this issue Dec 6, 2021 · 2 comments · Fixed by #6625
Assignees

Comments

@kozlovsky
Copy link
Contributor

In our Jenkins PR-triggered job for building the documentation, we have the following line:
python -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
which currently produces the error:

Traceback (most recent call last):
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinx/cmd/build.py", line 276, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinx/application.py", line 237, in __init__
    self.setup_extension(extension)
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinx/application.py", line 394, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinx/registry.py", line 429, in load_extension
    mod = import_module(extname)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinxcontrib/openapi/__init__.py", line 13, in <module>
    from sphinxcontrib.openapi import renderers, directive
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinxcontrib/openapi/renderers/__init__.py", line 4, in <module>
    from ._httpdomain_old import HttpdomainOldRenderer
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinxcontrib/openapi/renderers/_httpdomain_old.py", line 6, in <module>
    from .. import openapi20, openapi30, utils
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinxcontrib/openapi/openapi20.py", line 16, in <module>
    from sphinxcontrib.openapi import utils
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/sphinxcontrib/openapi/utils.py", line 20, in <module>
    from m2r import convert as convert_markdown
  File "/home/jenkins/workspace/GH_Tribler_PR_Tests/PR_build_docs/venv/lib/python3.8/site-packages/m2r.py", line 59, in <module>
    class RestBlockGrammar(mistune.BlockGrammar):
AttributeError: module 'mistune' has no attribute 'BlockGrammar'

The reason for the problem is the following bug of sphinxcontrib-openapi:
sphinx-contrib/openapi#121

And the reason for the bug is incompletely specified dependencies of sphinxcontrib-openapi.

To see the dependency graph, I installed the pipdeptree library:

> python -m pip install pipdeptree
> pipdeptree

With it, I can see the following dependency tree:

...
sphinxcontrib-openapi==0.7.0
  ...
  - m2r [required: >=0.2, installed: 0.2.1]
    ...
    - mistune [required: Any, installed: 2.0.0]
...

The m2r library requires the mistune library but does not specify the required version.

As it turns out, the API in version 2.0.0 of mistune has changed, and for the m2r library to work correctly, we need to use a previous version of mistune (0.8.4). With the mistune version 0.8.4, the documentation build works correctly.

To fix the problem, we need to specify the exact version of mistune in our doc requirements.

@kozlovsky kozlovsky self-assigned this Dec 6, 2021
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Dec 6, 2021
kozlovsky added a commit that referenced this issue Dec 6, 2021
Fixes #6624: specify the exact version of `mistune` library in doc/requirements.txt
@pmuntyanu
Copy link

Thank you, Installing mistune==0.8.4 helped

mayani added a commit to pegasus-isi/pegasus that referenced this issue Feb 3, 2022
arteymix added a commit to PavlidisLab/bioluigi that referenced this issue Feb 3, 2022
magnesj added a commit to OPM/ResInsight-UserDocumentation that referenced this issue Feb 7, 2022
magnesj added a commit to OPM/ResInsight-UserDocumentation that referenced this issue Apr 5, 2022
priesgo added a commit to TRON-Bioinformatics/covigator that referenced this issue Sep 10, 2022
@andrewteta
Copy link

this did not work for me on Intel Mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants