6

I have just used conda to update my Anaconda installation and Matplotlib went from v1.4.0 to v1.4.2. However now all my Python jobs which use Matplotlib.pyplot are throwing exceptions.

Even the simple command:

import matplotlib.pyplot as plt

throws a TypeError exception, saying:

cannot return std::string from Unicode object

The traceback tells me the exception is occurring in the font_manager.py file, here:

try:
    font = ft2font.FT2Font(fpath)
except RuntimeError:
    verbose.report("Could not open font file %s" % fpath)
    continue
except UnicodeError:
    verbose.report("Cannot handle unicode filenames")
    continue

specifically at the line font = ft2font.FT2Font(fpath).

I tried going back to v1.4.0 of Matplotlib but it didn't fix the problem.

Then I edited font_manager.py to add a generic exception case:

except:
    verbose.report("Some stupid error occurred")
    continue

in the hope that it would temporarily get around the issue, which it did, but that error or something very similar to it occurred later. So then I removed the exception but the error is now still occurring at the later point in the code (so if I run import matplotlib.pyplot as plt it works, but doing other commands can fail).

I use Matplotlib to generate/update hundreds of graphs throughout the day and now everything is broken.

Please help! Thanks!

4
  • I just had exactly the same problem after updating from matplotlib 1.3.x to 1.4.2 with conda Commented Jan 27, 2015 at 13:08
  • Same problem here... Did you end up finding a solution? Commented Jan 31, 2015 at 18:52
  • I ended up uninstalling and reinstalling Anaconda (pain in the neck!). But I can now import matplotlib (v1.4.0) and get on with my work. Commented Jan 31, 2015 at 20:01
  • 1
    I went in and edited the Matplotlib code where the problem was occurring. Then when I imported Matplotlib again, it got past that point and now it throws warnings about certain fonts being missing, but it works. Definitely not ideal! I think the proper solution is to uninstall and reinstall a fresh version of Anaconda as recommended by @pbreach. Commented Apr 2, 2015 at 16:33

1 Answer 1

1

It seems like uninstalling Anaconda and reinstalling a fresh version fixes the issue as mentioned by @pbreach, so closing this question out.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.