Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26468 > unrolled thread
| Started by | Eric <einazaki668@yahoo.com> |
|---|---|
| First post | 2012-08-03 20:12 -0700 |
| Last post | 2012-08-04 13:45 -0700 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.python
trouble with pyplot in os x Eric <einazaki668@yahoo.com> - 2012-08-03 20:12 -0700
Re: trouble with pyplot in os x "William R. Wing (Bill Wing)" <wrw@mac.com> - 2012-08-04 09:11 -0400
Re: trouble with pyplot in os x Eric <einazaki668@yahoo.com> - 2012-08-04 13:45 -0700
Re: trouble with pyplot in os x Eric <einazaki668@yahoo.com> - 2012-08-04 13:45 -0700
| From | Eric <einazaki668@yahoo.com> |
|---|---|
| Date | 2012-08-03 20:12 -0700 |
| Subject | trouble with pyplot in os x |
| Message-ID | <3a2464ec-8fbc-4c45-8509-6861031f9204@googlegroups.com> |
I'm just starting to futz around with matplotlib and I tried to run this
example from the matplotlib doc page (it's the imshow() example):
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
delta = 0.025
x = y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = Z2-Z1 # difference of Gaussians
im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
origin='lower', extent=[-3,3,-3,3])
plt.show()
I get the following error:
Exception in Tkinter callback
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
return self.func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 248, in resize
self.show()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 252, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
TclError
I'm using Python 2.7.3 on OS X 10.6.8 and I'm invoking python by doing
"arch -i386 python" because matplotlib doesn't do 64-bit. Has anyone
else seen this? Does anyone know why this is happening? It looks
like a problem with tkinter but beyond that I haven't a clue. And,
finally, any ideas as to how to make it behave?
TIA,
eric
[toc] | [next] | [standalone]
| From | "William R. Wing (Bill Wing)" <wrw@mac.com> |
|---|---|
| Date | 2012-08-04 09:11 -0400 |
| Message-ID | <mailman.2936.1344089518.4697.python-list@python.org> |
| In reply to | #26468 |
On Aug 3, 2012, at 11:12 PM, Eric <einazaki668@yahoo.com> wrote:
> I'm just starting to futz around with matplotlib and I tried to run this
> example from the matplotlib doc page (it's the imshow() example):
>
> import numpy as np
> import matplotlib.cm as cm
> import matplotlib.mlab as mlab
> import matplotlib.pyplot as plt
>
> delta = 0.025
> x = y = np.arange(-3.0, 3.0, delta)
> X, Y = np.meshgrid(x, y)
> Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
> Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
> Z = Z2-Z1 # difference of Gaussians
>
> im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
> origin='lower', extent=[-3,3,-3,3])
>
> plt.show()
>
>
OK
>
> I get the following error:
>
> Exception in Tkinter callback
> Traceback (most recent call last):
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
> return self.func(*args)
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 248, in resize
> self.show()
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 252, in draw
> tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit
> tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
> TclError
>
>
This looks as though you are running the latest python from python.org, not the pre-installed python from Apple (that's good).
>
> I'm using Python 2.7.3 on OS X 10.6.8 and I'm invoking python by doing
> "arch -i386 python" because matplotlib doesn't do 64-bit. Has anyone
> else seen this? Does anyone know why this is happening? It looks
> like a problem with tkinter but beyond that I haven't a clue. And,
> finally, any ideas as to how to make it behave?
>
I DON'T know how tk is getting mixed into this, it shouldn't be. But I think I can tell you how to get matplotlib working...
Matplotlib DOES do 64-bit, the problem is numpy, which as you download in binary form does not. But, if you copy the bash script here:
https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
it will download the sources and build a 64-bit numpy, which will then give you a default 64-bit full package of python, numpy, and matplotlib.
That's what I've done, and my system runs the demo you listed in your post with no problems.
> TIA,
> eric
> --
> http://mail.python.org/mailman/listinfo/python-list
Good luck,
-Bill
[toc] | [prev] | [next] | [standalone]
| From | Eric <einazaki668@yahoo.com> |
|---|---|
| Date | 2012-08-04 13:45 -0700 |
| Message-ID | <mailman.2949.1344113157.4697.python-list@python.org> |
| In reply to | #26487 |
On Saturday, August 4, 2012 8:11:44 AM UTC-5, William R. Wing (Bill Wing) wrote:
> On Aug 3, 2012, at 11:12 PM, Eric wrote:
>
>
>
> > I'm just starting to futz around with matplotlib and I tried to run this
>
> > example from the matplotlib doc page (it's the imshow() example):
>
> >
>
> > import numpy as np
>
> > import matplotlib.cm as cm
>
> > import matplotlib.mlab as mlab
>
> > import matplotlib.pyplot as plt
>
> >
>
> > delta = 0.025
>
> > x = y = np.arange(-3.0, 3.0, delta)
>
> > X, Y = np.meshgrid(x, y)
>
> > Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
>
> > Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
>
> > Z = Z2-Z1 # difference of Gaussians
>
> >
>
> > im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
>
> > origin='lower', extent=[-3,3,-3,3])
>
> >
>
> > plt.show()
>
> >
>
> >
>
>
>
> OK
>
>
>
> >
>
> > I get the following error:
>
> >
>
> > Exception in Tkinter callback
>
> > Traceback (most recent call last):
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
>
> > return self.func(*args)
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 248, in resize
>
> > self.show()
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 252, in draw
>
> > tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit
>
> > tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
>
> > TclError
>
> >
>
> >
>
>
>
> This looks as though you are running the latest python from python.org, not the pre-installed python from Apple (that's good).
>
>
>
> >
>
> > I'm using Python 2.7.3 on OS X 10.6.8 and I'm invoking python by doing
>
> > "arch -i386 python" because matplotlib doesn't do 64-bit. Has anyone
>
> > else seen this? Does anyone know why this is happening? It looks
>
> > like a problem with tkinter but beyond that I haven't a clue. And,
>
> > finally, any ideas as to how to make it behave?
>
> >
>
>
>
> I DON'T know how tk is getting mixed into this, it shouldn't be. But I think I can tell you how to get matplotlib working...
>
>
>
> Matplotlib DOES do 64-bit, the problem is numpy, which as you download in binary form does not. But, if you copy the bash script here:
>
>
>
> https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
>
>
>
> it will download the sources and build a 64-bit numpy, which will then give you a default 64-bit full package of python, numpy, and matplotlib.
>
>
>
> That's what I've done, and my system runs the demo you listed in your post with no problems.
>
>
>
> > TIA,
>
> > eric
>
> > --
>
> > http://mail.python.org/mailman/listinfo/python-list
>
>
>
> Good luck,
>
> -Bill
Yes, I got the Python 2.7 (and 3.2) distributions from python.org and I also got Tcl/Tk per their directions. I still have all the old Apple installed stuff too plus some older Tcl/Tk.
Doesn't matplotlib use Tk (Tkinter) to do its graphs and what-not? I also have at least two different versions of Tcl/Tk (8.5.7 and 8.5.12) and I'm wondering if that may not be causing problems.
I'll give that bash script a try.
Thanks,
eric
[toc] | [prev] | [next] | [standalone]
| From | Eric <einazaki668@yahoo.com> |
|---|---|
| Date | 2012-08-04 13:45 -0700 |
| Message-ID | <f038f218-3a7b-4ff3-8cab-056a47990e93@googlegroups.com> |
| In reply to | #26487 |
On Saturday, August 4, 2012 8:11:44 AM UTC-5, William R. Wing (Bill Wing) wrote:
> On Aug 3, 2012, at 11:12 PM, Eric wrote:
>
>
>
> > I'm just starting to futz around with matplotlib and I tried to run this
>
> > example from the matplotlib doc page (it's the imshow() example):
>
> >
>
> > import numpy as np
>
> > import matplotlib.cm as cm
>
> > import matplotlib.mlab as mlab
>
> > import matplotlib.pyplot as plt
>
> >
>
> > delta = 0.025
>
> > x = y = np.arange(-3.0, 3.0, delta)
>
> > X, Y = np.meshgrid(x, y)
>
> > Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
>
> > Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
>
> > Z = Z2-Z1 # difference of Gaussians
>
> >
>
> > im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
>
> > origin='lower', extent=[-3,3,-3,3])
>
> >
>
> > plt.show()
>
> >
>
> >
>
>
>
> OK
>
>
>
> >
>
> > I get the following error:
>
> >
>
> > Exception in Tkinter callback
>
> > Traceback (most recent call last):
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
>
> > return self.func(*args)
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 248, in resize
>
> > self.show()
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 252, in draw
>
> > tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit
>
> > tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
>
> > TclError
>
> >
>
> >
>
>
>
> This looks as though you are running the latest python from python.org, not the pre-installed python from Apple (that's good).
>
>
>
> >
>
> > I'm using Python 2.7.3 on OS X 10.6.8 and I'm invoking python by doing
>
> > "arch -i386 python" because matplotlib doesn't do 64-bit. Has anyone
>
> > else seen this? Does anyone know why this is happening? It looks
>
> > like a problem with tkinter but beyond that I haven't a clue. And,
>
> > finally, any ideas as to how to make it behave?
>
> >
>
>
>
> I DON'T know how tk is getting mixed into this, it shouldn't be. But I think I can tell you how to get matplotlib working...
>
>
>
> Matplotlib DOES do 64-bit, the problem is numpy, which as you download in binary form does not. But, if you copy the bash script here:
>
>
>
> https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
>
>
>
> it will download the sources and build a 64-bit numpy, which will then give you a default 64-bit full package of python, numpy, and matplotlib.
>
>
>
> That's what I've done, and my system runs the demo you listed in your post with no problems.
>
>
>
> > TIA,
>
> > eric
>
> > --
>
> > http://mail.python.org/mailman/listinfo/python-list
>
>
>
> Good luck,
>
> -Bill
Yes, I got the Python 2.7 (and 3.2) distributions from python.org and I also got Tcl/Tk per their directions. I still have all the old Apple installed stuff too plus some older Tcl/Tk.
Doesn't matplotlib use Tk (Tkinter) to do its graphs and what-not? I also have at least two different versions of Tcl/Tk (8.5.7 and 8.5.12) and I'm wondering if that may not be causing problems.
I'll give that bash script a try.
Thanks,
eric
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web