Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot import matplotlib.pyplot #17140

Closed
Closed
@qrrcnaxne

Description

@qrrcnaxne

Bug report

Cannot import matplotlib.pyplot, fontlist-v310.json file not found in the .cache directory

Code for reproduction
import matplotlib.pyplot

Actual outcome

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/matplotlib/font_manager.py", line 1341, in <module>
    fontManager = json_load(_fmcache)
  File "/usr/lib/python3.8/site-packages/matplotlib/font_manager.py", line 936, in json_load
    with open(filename, 'r') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/home/deepankar/.cache/matplotlib/fontlist-v310.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/matplotlib/pyplot.py", line 32, in <module>
    import matplotlib.colorbar
  File "/usr/lib/python3.8/site-packages/matplotlib/colorbar.py", line 31, in <module>
    import matplotlib.contour as contour
  File "/usr/lib/python3.8/site-packages/matplotlib/contour.py", line 16, in <module>
    import matplotlib.font_manager as font_manager
  File "/usr/lib/python3.8/site-packages/matplotlib/font_manager.py", line 1343, in <module>
    _rebuild()
  File "/usr/lib/python3.8/site-packages/matplotlib/font_manager.py", line 1334, in _rebuild
    fontManager = FontManager()
  File "/usr/lib/python3.8/site-packages/matplotlib/font_manager.py", line 991, in __init__
    self.addfont(path)
  File "/usr/lib/python3.8/site-packages/matplotlib/font_manager.py", line 1013, in addfont
    font = ft2font.FT2Font(path)
KeyboardInterrupt

Expected outcome
Successful import

Matplotlib version

  • Operating system: Arch Linux
  • Matplotlib version: 3.2.1-1 and 3.2.0-1
  • Matplotlib backend (print(matplotlib.get_backend())): Cannot execute the command, same error
  • Python version: 3.8.2

Matplotlib installed with pacman -S python-matplotlib

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions