AdamoAndrej
AdamoAndrej

Reputation: 21

Python TensorFlow

I am having a problem with instaling Tensorflow module, I've done my research but I was unable to find the solution Online. I am running only the tensorflow example code.

import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile

from distutils.version import StrictVersion
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image

# This is needed since the notebook is stored in the object_detection folder.
sys.path.append("..")
from object_detection.utils import ops as utils_ops

if StrictVersion(tf.__version__) < StrictVersion('1.9.0'):
  raise ImportError('Please upgrade your TensorFlow installation to v1.9.* or later!')

and this is the output:

FileNotFoundError                         Traceback (most recent call last)
c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in <module>()
   1352         try:
-> 1353             fontManager = json_load(_fmcache)
   1354             if (not hasattr(fontManager, '_version') or

c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in json_load(filename)
    887     """
--> 888     with open(filename, 'r') as fh:
    889         return json.load(fh, object_hook=_json_decode)

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Mestre\\.matplotlib\\fontlist-v300.json'

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-1-1e9eee4e6961> in <module>()
     10 from collections import defaultdict
     11 from io import StringIO
---> 12 from matplotlib import pyplot as plt
     13 from PIL import Image
     14 

c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\pyplot.py in <module>()
     30 from cycler import cycler
     31 import matplotlib
---> 32 import matplotlib.colorbar
     33 import matplotlib.image
     34 from matplotlib import rcsetup, style

c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\colorbar.py in <module>()
     30 import matplotlib.collections as collections
     31 import matplotlib.colors as colors
---> 32 import matplotlib.contour as contour
     33 import matplotlib.cm as cm
     34 import matplotlib.gridspec as gridspec

c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\contour.py in <module>()
     16 import matplotlib.colors as mcolors
     17 import matplotlib.collections as mcoll
---> 18 import matplotlib.font_manager as font_manager
     19 import matplotlib.text as text
     20 import matplotlib.cbook as cbook

c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in <module>()
   1361             raise
   1362         except Exception:
-> 1363             _rebuild()
   1364     else:
   1365         _rebuild()

c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in _rebuild()
   1342         global fontManager
   1343 
-> 1344         fontManager = FontManager()
   1345 
   1346         if _fmcache:

c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in __init__(self, size, weight)
    976         self.defaultFont = {}
    977 
--> 978         ttffiles = findSystemFonts(paths) + findSystemFonts()
    979         self.defaultFont['ttf'] = next(
    980             (fname for fname in ttffiles

c:\users\mestre\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in findSystemFonts(fontpaths, fontext)
    262             fontpaths = [win32FontDirectory()]
    263             # now get all installed fonts directly...
--> 264             fontfiles.update(win32InstalledFonts(fontext=fontext))
    265         else:
    266             fontpaths = X11FontDirectories

TypeError: 'NoneType' object is not iterable

It seems a problem with matplotlib but I've already instaled that module, and compiled the protoc files and this is the third I've trying to install tensorflow but without sucess. Thanks to all the lads who'll reply Thanks again, Paula

Upvotes: 1

Views: 299

Answers (1)

BigBadMe
BigBadMe

Reputation: 1842

It's a bug in matplotlib. In lib/matplotlib/font_manager.py you need to change the win32InstalledFonts function to return [] instead of return None.

Documented here: https://github.com/matplotlib/matplotlib/pull/12174/files

Upvotes: 1

Related Questions