#67702 closed defect (fixed)

import matplotlib.pyplot as plt fails

Reported by: dershow Owned by: reneeotten (Renee Otten)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: py-matplotlib

Description

I have py39-matplotlib port installed. When I then try:

>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/pyplot.py", line 55, in <module>
    from matplotlib import rcsetup, style
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/style/__init__.py", line 1, in <module>
    from .core import available, context, library, reload_library, use
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/style/core.py", line 26, in <module>
    import importlib_resources
ModuleNotFoundError: No module named 'importlib_resources'

I found a work around:

sudo port install py39-importlib-resources

Perhaps this should be a dependent?

Change History (2)

comment:1 Changed 11 months ago by reneeotten (Renee Otten)

Cc: reneeotten removed
Owner: set to reneeotten
Port: py-matplotlib added; matplotlib removed
Status: newaccepted

sorry for the trouble and thanks for reporting!

I never noticed this as many other packages have importlib-resources as a dependency so many people will have this already. But yes, you are correct that it should be a dependency; it's just a little strange to me that they have only listed it under extra_requires, which typically means it's only needed for certain additional features and not needed for "normal" usage. However, from looking at the documentation it looks like that is not their intention. Of course, it's also possible that I am misunderstanding the intended usage of extra_requires. Nevertheless, I will add it as a dependency shortly and push the change.

comment:2 Changed 11 months ago by reneeotten (Renee Otten)

Resolution: fixed
Status: acceptedclosed

In 3298649d5ccb8d1c047deb5bf6707b98b24c5f14/macports-ports (master):

py-matplotlib: add missing dependency

Closes: #67702

Note: See TracTickets for help on using tickets.