Lately when I try to show a plot, a white box shows up on my screen in the shape of the window that should be produced, but it doesn't have any UI elements -- no "X" button, no title-bar, nothing. Screenshot below:
The plain white box in the center of the screen shows up when draw() is called, in the shape of the figure that matplotlib should produce, but never fills in with anything.
In an interactive Python session I can produce plots, but I get the following barfed back:
2013-05-13 16:52:00.253 Python[21360:a0f] *** __NSAutoreleaseNoPool(): Object 0x1083e1d50 of class NSCFArray autoreleased with no pool in place - just leaking
2013-05-13 16:52:00.255 Python[21360:a0f] *** __NSAutoreleaseNoPool(): Object 0x10838e060 of class __NSFastEnumerationEnumerator autoreleased with no pool in place - just leaking
2013-05-13 16:52:00.262 Python[21360:a0f] *** __NSAutoreleaseNoPool(): Object 0x1083c41a0 of class NSObject autoreleased with no pool in place - just leaking
I have installed and tried all versions of Matplotlib available on the website, and I have had the same problem with every one. Since I'm running Mac OS X 10.6, it seems likely that it's an issue related to my OS but I can't remedy it with any of the recommended tips on stackoverflow. I'm aware of the setup precautions for OSX regarding libpng and freetype and I know that both are properly installed. To ensure that it wasn't an installation issue due to something silly like that, I tried installing Enthought and running their version of matplotlib, but I still have the same problem.
What backend do you have configured in your ~/.matplotlib/matplotlibrc file?
By default it seems to be GTKAgg. Changing it to MacOSX as suggested by some threads doesn't fix it.
Wow, this looks pretty broke! @efiring / @mdehoon / @dmcdougall - do any of you have 10.6 available?
@bmorris3 - because you get this with different backends (you can check which backend is actually being used with import matplotlib.pyplot as plt; plt.get_backend()) it would suggest that there is a problem with your Python installation. Are you able to run idle (the standard python editor)?
import matplotlib.pyplot as plt; plt.get_backend()
plt.get_backened() returns MacOSX.
Yes, I can run idle.
plt.get_backened() returns MacOSX.
Was GTKAgg a red-herring then? I'm trying to isolate where the problem could be, so if it is only on the MacOSX backend then we have a pretty good candidate where the problem lies, otherwise it's likely that the problem is with your Python setup...
GTKAgg was the default setting in ~/.matplotlib/matplotlibrc, and then since I had seen some suggestions that I'd be safer with the MacOSX backened, I switched it to MacOSX. I can switch it back if you think that's a good idea for debugging.
@pelson, no, I don't have access to 10.6.
There is a lot of information missing here--e.g., what kind of Python (system, python.org, fink, darwinports, homebrew...); what is the difference between "when I try to show a plot" and "in an interactive Python session"? etc.
It sounds like the system was working normally, and then this problem started. Something in the system must have changed. Something that is assumed to be true, isn't true. If the behavior is the same with Enthought as before, then either the problem is deep in the system, or when you think you are running Enthought python, you aren't, or... who knows?
Ok, I've completely deleted Python 2.7 from my machine and started fresh with new packages and I'm still getting the same error, so I'll go into some detail as per @efiring . I'm running Mac 10.6.8 with Xcode 3.2.6 (64 bit). Here's the list of packages relavent to matplotlib that I installed:
And some others that I don't think should matter but I installed so that I could run my script:
I've checked that I'm not running Python from the Enthought distro which I did not remove:
% which python
Before installing mpl I installed freetype and libpng with this command and these warnings
% sudo port install libpng freetype
Warning: Error parsing file /opt/local/lib/apple-gcc40/lib/gcc/i686-apple-darwin10.8.0/4.0.1/kext/crt3.o: Premature end of data, possibly corrupt file
---> Scanning binaries for linking errors: 14.5%
Warning: Error parsing file /opt/local/lib/apple-gcc40/lib/gcc/i686-apple-darwin10.8.0/4.0.1/static/crt3.o: Premature end of data, possibly corrupt file
which are expected according to this thread.
Then I installed mpl from source with python setup.py install, and I noticed this warning:
python setup.py install
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
and this one
i686-apple-darwin10-gcc-4.2.1: Tcl: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because linking not done
i686-apple-darwin10-gcc-4.2.1: Tk: linker input file unused because linking not done
I wanted to check on @pelson 's comments on the backend what my backend is in my ~/.matplotlib/matplotlibrc file, but there is none. In my ~/.matplotlib/ directory I only find:
If I check using @pelson 's method (plt.get_backend()), I get MacOSX.
I've tried using plt.savefig(<filename>) to save the plots as they are produced so that I can try to take a look at them from a non-interactive perspective, but they don't ever save -- the files never show up.
The code that I'm running that makes the white plot is quite complicated, but it amounts to a call of this script (link to my GitHub repo copy). I've tried running simpler scripts to test whether or not the problem is specific to my script; here's a simple interactive plot I made that successfully produces a plot, but returns some leaking warnings that I've never seen before
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib import pyplot as plt
[<matplotlib.lines.Line2D object at 0x1022c5c10>]
2013-05-14 22:17:00.236 Python[9138:607] *** __NSAutoreleaseNoPool(): Object 0x115701380 of class NSCFArray autoreleased with no pool in place - just leaking
2013-05-14 22:17:00.238 Python[9138:607] *** __NSAutoreleaseNoPool(): Object 0x115703110 of class __NSFastEnumerationEnumerator autoreleased with no pool in place - just leaking
2013-05-14 22:17:00.240 Python[9138:607] *** __NSAutoreleaseNoPool(): Object 0x102399360 of class NSObject autoreleased with no pool in place - just leaking
Does any of that bring any insight?
I think this would be easier to follow and more likely to be productive on the users' mailing list. Many more people would see it, and it would be possible to respond to particular messages instead of ending up with this single linear thread. It is also more appropriate because this does not appear to be a bug in mpl. When you move your question to the mailing list, you can also provide more information--a more thorough description of how you generate the problem (e.g., running interactively from the plain python prompt? From ipython --pylab? From a script?), and of what might have changed on your system at the time of transition from working to non-working.
I'm going to close this issue, but you can still refer to it in your post to the matplotlib-users list.
Go to https://lists.sourceforge.net/lists/listinfo/matplotlib-users to subscribe. Do not select the "batched in a daily digest" option, because it makes it difficult to respond properly to individual messages, and at least while you are trying to get a problem solved, you will want to do so. Once subscribed, you simply write to email@example.com.