Matplotlib is a heavily used package in the Python scientific community and I hope that this article helps other readers resolve this strange and hard to pinpoint issue. While this post is not exactly related to computer vision or OpenCV, I still want to share my experience and solution with other PyImageSearch readers. Luckily, after a lot of trial and error (and spending an entire day trying to come up with a solution), I have been able to resolve the problem and get matplotlib figures to show up and display on my screen on both the Ubuntu and Raspbian operating systems (and when using Python virtual environments). The issue actually stems from the matplotlib backend not being properly set, or from a missing dependency when compiling and installing matplotlib. This issue is only further compounded when utilizing virtual environments via the virtualenv and virtualenvwrapper packages. This is actually a common problem I’ve ran into over the past few months, especially when working with Debian based operating systems such as Ubuntu and Raspbian. I coded up a quick Python script using matplotlib, executed the script, only to not have the figure displayed to my screen. Over the weekend I was playing around with deep learning on my Ubuntu system and went to plot the accuracy scores of my classifier. I think a better title for this blog post might be: How I lost a day of productivity to Ubuntu, virtual environments, matplotlib, and rendering backends. Click here to download the source code to this post
0 Comments
Leave a Reply. |