-1

I am getting this issue

Traceback (most recent call last):
  File "Path.py", line 4, in <module>
    import matplotlib.pyplot as plt
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 131, in <module>
    from matplotlib.rcsetup import defaultParams, validate_backend, cycler
  File "C:\Python27\lib\site-packages\matplotlib\rcsetup.py", line 29, in <module>
    from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
  File "C:\Python27\lib\site-packages\matplotlib\fontconfig_pattern.py", line 28, in <module>
    from backports.functools_lru_cache import lru_cache
ImportError: No module named functools_lru_cache

I have tried so far:-

  • To uninstall functools_lru_cache and install it again
  • To uninstall matplotlib and install it again
  • Removing the folders from site-dist and installing again

I have installed Python and Pylint for VS Code when it broke. It is not only related to VS Code, I cannot run the code directly from CMD either.

1 Answers1

0

Consider using this technique for importing the ‘lru_cache’ function:

try:
    from functools import lru_cache
except ImportError:
    from backports.functools_lru_cache import lru_cache

Anyway, this is the website: https://pypi.python.org/pypi/backports.functools_lru_cache

you can do it this way too in a line command

pip install backports.functools_lru_cache
Julio CamPlaz
  • 857
  • 8
  • 18