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

Failing make docs - Could not import extension m2r #552

Open
michalbil opened this issue Mar 12, 2024 · 0 comments · May be fixed by #553
Open

Failing make docs - Could not import extension m2r #552

michalbil opened this issue Mar 12, 2024 · 0 comments · May be fixed by #553

Comments

@michalbil
Copy link
Collaborator

Describe the bug

In an environment created according to CONTRIBUTING doc, running make docs fails as below:

$ poetry run make docs
rm -fr docs/_build/
rm -fr docs/_diagrams/
make -C docs html
make[1]: Entering directory '/home/bil/projects/github.com/PaloAltoNetworks/pan-os-python/docs'
sphinx-build -b html -a -v -d _build/doctrees   . _build/html
Running Sphinx v2.4.3
WARNING: while setting up extension sphinx.addnodes: node class 'meta' is already registered, its visitors will be overridden
Original exception:
Traceback (most recent call last):
  File "/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/sphinx/registry.py", line 453, in load_extension
    mod = import_module(extname)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bil/.pyenv/versions/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/m2r.py", line 13, in <module>
    from docutils.core import ErrorString
ImportError: cannot import name 'ErrorString' from 'docutils.core' (/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/docutils/core.py)


Traceback (most recent call last):
  File "/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/sphinx/registry.py", line 453, in load_extension
    mod = import_module(extname)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bil/.pyenv/versions/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/m2r.py", line 13, in <module>
    from docutils.core import ErrorString
ImportError: cannot import name 'ErrorString' from 'docutils.core' (/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/docutils/core.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/sphinx/cmd/build.py", line 272, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/sphinx/application.py", line 245, in __init__
    self.setup_extension(extension)
  File "/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/sphinx/application.py", line 397, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/sphinx/registry.py", line 456, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname, err)
sphinx.errors.ExtensionError: Could not import extension m2r (exception: cannot import name 'ErrorString' from 'docutils.core' (/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/docutils/core.py))

Extension error:
Could not import extension m2r (exception: cannot import name 'ErrorString' from 'docutils.core' (/home/bil/.cache/pypoetry/virtualenvs/pan-os-python-UFhtxCNV-py3.11/lib/python3.11/site-packages/docutils/core.py))
make[1]: *** [Makefile:57: html] Error 2
make[1]: Leaving directory '/home/bil/projects/github.com/PaloAltoNetworks/pan-os-python/docs'
make: *** [Makefile:71: docs] Error 2

Expected behavior

Documentation is generated.

Current behavior

Docs generation fails.

Possible solution

Bump m2r to 0.3.1.

Steps to reproduce

  1. poetry install (create new env + install pkgs)
  2. poetry run make docs (generate html docs)

Context

Discovered when testing a small documentation fix.

Your Environment

  • Version used: develop@bc96108
  • Environment name and version: python 3.11.4
  • Operating System and version: WSL/Ubuntu
  • Link to your project: n/a
@michalbil michalbil linked a pull request Mar 12, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant