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

0.9.1: not ready for matplotlib 3.8.4?🤔 #121

Open
kloczek opened this issue Apr 7, 2024 · 2 comments
Open

0.9.1: not ready for matplotlib 3.8.4?🤔 #121

kloczek opened this issue Apr 7, 2024 · 2 comments

Comments

@kloczek
Copy link

kloczek commented Apr 7, 2024

On building urllib3 documentation in build env with installed matplotlib 3.8.4 I found that sphinx fails in sphinxext-opengraph with:

+ /usr/bin/sphinx-build -n -T -b man docs build/sphinx/man
Running Sphinx v7.2.6

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/sphinx/registry.py", line 447, in load_extension
    mod = import_module(extname)
  File "/usr/lib64/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/sphinxext/opengraph/__init__.py", line 19, in <module>
    from .socialcards import create_social_card, DEFAULT_SOCIAL_CONFIG
  File "/usr/lib/python3.10/site-packages/sphinxext/opengraph/socialcards.py", line 5, in <module>
    from matplotlib import pyplot as plt
ImportError: cannot import name 'pyplot' from 'matplotlib' (unknown location)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/sphinx/cmd/build.py", line 293, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 233, in __init__
    self.setup_extension(extension)
  File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 406, in setup_extension
    self.registry.load_extension(self, extname)
  File "/usr/lib/python3.10/site-packages/sphinx/registry.py", line 450, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname,
sphinx.errors.ExtensionError: Could not import extension sphinxext.opengraph (exception: cannot import name 'pyplot' from 'matplotlib' (unknown location))

Extension error:
Could not import extension sphinxext.opengraph (exception: cannot import name 'pyplot' from 'matplotlib' (unknown location))
@TheTripleV
Copy link
Member

Weird. https://github.com/wpilibsuite/sphinxext-opengraph/blob/main/sphinxext/opengraph/__init__.py#L12 should check for that and prevent matplotlib from loading if its not installed.

I guess that check should be the exact same import that's called later, from matplotlib import pyplot as plt

@kloczek
Copy link
Author

kloczek commented Apr 15, 2024

That is because matplotlib install dependency is optional.

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

No branches or pull requests

2 participants