Opened 6 years ago

Closed 6 years ago

#56789 closed defect (fixed)

py27-matplotlib: missing py27-backports-functools_lru_cache dependency

Reported by: mfacorcoran Owned by: seanfarley (Sean Farley)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: py-matplotlib

Description

I upgraded to py27-matplotlib@2.2.2 recently and when I started ipython and imported matplotlib I got the following error:

[gs66w-corcoran:~] corcoran% ipython
[TerminalIPythonApp] WARNING | Config option `ignore_old_config` not recognized by `TerminalIPythonApp`.
Python 2.7.15 (default, May  4 2018, 07:56:34)
Type "copyright", "credits" or "license" for more information.

IPython 5.4.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import matplotlib
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-82be63b7783c> in <module>()
----> 1 import matplotlib

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc in <module>()
    129     _backports, mplDeprecation, dedent, get_label, sanitize_sequence)
    130 from matplotlib.compat import subprocess
--> 131 from matplotlib.rcsetup import defaultParams, validate_backend, cycler
    132
    133 import numpy

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/rcsetup.py in <module>()
     27 from matplotlib import cbook, testing
     28 from matplotlib.cbook import mplDeprecation, deprecated, ls_mapper
---> 29 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
     30 from matplotlib.colors import is_color_like
     31

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/fontconfig_pattern.py in <module>()
     26     from functools import lru_cache
     27 except ImportError:
---> 28     from backports.functools_lru_cache import lru_cache
     29
     30 family_punc = r'\\\-:,'

ImportError: No module named functools_lru_cache

Following https://github.com/matplotlib/matplotlib/issues/9344, I installed version 1.5 of py27-backports-functools_lru_cache:

sudo port install py27-backports-functools_lru_cache

and that seemed to resolve the issue. It looks like the dependency on py27-backports-functools_lru_cache may be missing from the matplotlib package

Change History (7)

comment:1 Changed 6 years ago by mf2k (Frank Schima)

Owner: set to seanfarley
Port: py-matplotlib added
Status: newassigned

In the future, please fill in the Port field and add the port maintainer(s) to Cc (port info --maintainers py27-matplotlib), if any.

comment:2 Changed 6 years ago by mf2k (Frank Schima)

Works fine for me with python 3.6. Must be a python 2 issue only.

Last edited 6 years ago by mf2k (Frank Schima) (previous) (diff)

comment:3 Changed 6 years ago by seanfarley (Sean Farley)

Yeah, looks like it's missing this dependency for python 2.7

comment:4 Changed 6 years ago by jmroot (Joshua Root)

Summary: missing matplotlib dependency?py27-matplotlib: missing py27-backports-functools_lru_cache dependency

comment:5 Changed 6 years ago by reneeotten (Renee Otten)

From looking at the Portfile that doesn't seem to be the case, the dependency on py27-backports-functools_lru_cache is present for Python 2.7.

comment:6 Changed 6 years ago by reneeotten (Renee Otten)

okay, the problem was probably introduced with an update of py27-backports-functools_lru_cache that I did about a week ago. It looks like that version changed (I think incorrectly) its __init__.py file and when trying to upgrade it one sees the following message (new installs do work though):

Error: Failed to activate py27-backports-functools_lru_cache: Image error: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/backports/__init__.py is being used by the active py27-backports port. Please deactivate this port first, or use 'port -f activate py27-backports-functools_lru_cache' to force the activation.

It's easy enough though to miss this message when trying to update many ports... The unfortunate side effect is that the previous version of py27-backports-functools_lru_cache is already deactivated and the new one cannot be activated, effectively resulting in removal of the package. This likely affects other ports that rely on this package and could explain some other failures I noticed myself recently (e.g., https://github.com/macports/macports-ports/pull/2168).

Sorry about that, I will take a look at it and will submit a PR to fix this as soon as possible.

Version 0, edited 6 years ago by reneeotten (Renee Otten) (next)

comment:7 Changed 6 years ago by reneeotten <reneeotten@…>

Resolution: fixed
Status: assignedclosed

In 5549daede85b41d4000ad13a7b841e439e8b09d9/macports-ports (master):

py-backports-functools_lru_cache: fix activation issue

The init.py file is present in various packages within the backports
namespace, preventing port activation. Therefore, add py-backports as a
dependency and do not install those files from this port (solution taken
from several other py-backports-* Portfiles).

Closes: #56789

Note: See TracTickets for help on using tickets.