1
File "<stdin>", line 1, in <module>
  File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 32, in <module>
    import matplotlib.colorbar
  File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\colorbar.py", line 32, in <module>
    import matplotlib.contour as contour
  File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\contour.py", line 18, in <module>
    import matplotlib.font_manager as font_manager
  File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1363, in <module>
    _rebuild()
  File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1344, in _rebuild
    fontManager = FontManager()
  File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 978, in __init__
    ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 264, in findSystemFonts
    fontfiles.update(win32InstalledFonts(fontext=fontext))
TypeError: 'NoneType' object is not iterable

I've tried to uninstall and reinstall matplotlib in many ways, but I still get the above error.

Sheldore
  • 37,862
  • 7
  • 57
  • 71
fpi
  • 313
  • 1
  • 5
  • 15
  • 1
    Perhaps [this](https://stackoverflow.com/questions/48268935/why-is-matplotlib-failing-on-import-matplotlib-pyplot-as-plt), [this](https://stackoverflow.com/questions/24302091/error-when-import-matplotlib-pyplot-as-plt), [this](https://stackoverflow.com/questions/24243203/import-matplotlib-pyplot-as-plt-fails-with-error-about-python-tk) or [this](https://stackoverflow.com/questions/43573248/how-to-resolve-import-matplotlib-pyplot-as-plt-error) helps you – Sheldore Sep 22 '18 at 16:15
  • thanks, but I've already seen this links. I'm using anaconda – fpi Sep 22 '18 at 16:21
  • which version of matplotlib are you using? – ImportanceOfBeingErnest Sep 22 '18 at 16:24
  • matplotlib 3.0.0 – fpi Sep 22 '18 at 16:26
  • Then it's [this new error](https://github.com/matplotlib/matplotlib/issues/12173) which is not yet fixed. – ImportanceOfBeingErnest Sep 22 '18 at 16:34
  • so, can i solve this installing another version? which do you suggest me? – fpi Sep 22 '18 at 16:37
  • In conda list I have this output: matplotlib 3.0.0 py35h7b168c4_1 conda-forge matplotlib 3.0.0 – fpi Sep 22 '18 at 16:49
  • I think for the moment you may revert to version 2.2.3. I'm not sure what the solution to this problem will be in the end, it's still being discussed, but there should probably be a bugfix release soon. – ImportanceOfBeingErnest Sep 22 '18 at 17:32
  • thank you! Now it works with the version 2.2.3 – fpi Sep 22 '18 at 18:23

1 Answers1

1

I met this problem and fixxed it with installing the old version. Try:

pip uninstall matplotlib

pip install -v matplotlib==2.2.2

It seem that this bug casued by the incorrect use of pathlib package in matplotlib.font_manager.py

Wendroff
  • 98
  • 1
  • 6