Skip to content

matplotlib.pyplot import gives error on MacOSX #11822

Closed
@lucilla7

Description

@lucilla7

Bug report

Bug summary

Import matplotlib.pyplot fails on MacOSX

Code for reproduction

import matplotlib.pyplot as plt

Actual outcome

Traceback (most recent call last):
  File "/Users/Apollo/PycharmProjects/CT_registration/main.py", line 114, in <module>
    moving_npa=fixed(sitk.GetArrayViewFromImage(movingImage)))
  File "/Users/Apollo/venv/lib/python2.7/site-packages/ipywidgets/widgets/interaction.py", line 531, in __call__
    show_inline_matplotlib_plots()
  File "/Users/Apollo/venv/lib/python2.7/site-packages/ipywidgets/widgets/interaction.py", line 52, in show_inline_matplotlib_plots
    from ipykernel.pylab.backend_inline import flush_figures
  File "/Users/Apollo/venv/lib/python2.7/site-packages/ipykernel/pylab/backend_inline.py", line 9, in <module>
    from matplotlib.backends.backend_agg import new_figure_manager, FigureCanvasAgg # analysis: ignore
  File "/Users/Apollo/venv/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 32, in <module>
    from matplotlib.backend_bases import (
  File "/Users/Apollo/venv/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 53, in <module>
    from matplotlib import (
  File "/Users/Apollo/venv/lib/python2.7/site-packages/matplotlib/textpath.py", line 17, in <module>
    import matplotlib.font_manager as font_manager
  File "/Users/Apollo/venv/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1469, in <module>
    _rebuild()
  File "/Users/Apollo/venv/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1450, in _rebuild
    fontManager = FontManager()
  File "/Users/Apollo/venv/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1086, in __init__
    self.ttflist = createFontList(self.ttffiles)
  File "/Users/Apollo/venv/lib/python2.7/site-packages/matplotlib/font_manager.py", line 587, in createFontList
    font = ft2font.FT2Font(fpath)
TypeError: First argument must be a path or file object reading bytes

Process finished with exit code 1

Expected outcome

Matplotlib version

  • Operating system: Mac OS X Lion 10.7.5
  • Matplotlib version: 2.2.2
  • Matplotlib backend: MacOSX
  • Python version: 2.7.1
  • Jupyter version: jupyter-client==5.2.3 jupyter-core==4.4.0
  • Other libraries: SimpleITK, ipywidgets

I installed matplotlib from source. I am on a virtual environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions