[matplotlib-devel] Fixing matplotlib for wxPython 2.8

2009-07-10 Thread Gael Varoquaux
It seems that the following fix is necessary for matplolitb to work
wxPython 2.8.

Index: lib/matplotlib/backends/backend_wx.py
===
--- lib/matplotlib/backends/backend_wx.py   (revision 7250)
+++ lib/matplotlib/backends/backend_wx.py   (working copy)
@@ -117,7 +117,7 @@
 
 try:
 wxversion.ensureMinimal('2.8')
-except wxversion.AlreadyImportedError:
+except wxversion.VersionError()
 pass

Cheers,

Gaël

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Fixing matplotlib for wxPython 2.8

2009-07-10 Thread Gael Varoquaux
It seems that matplotlib needs the following patch for wxPython 2.8
(traceback hard to replicate, as you need to import wx before importing
matplotlib):

Index: lib/matplotlib/backends/backend_wx.py
===
--- lib/matplotlib/backends/backend_wx.py   (revision 7250)
+++ lib/matplotlib/backends/backend_wx.py   (working copy)
@@ -117,7 +117,7 @@
 
 try:
 wxversion.ensureMinimal('2.8')
-except wxversion.AlreadyImportedError:
+except wxversion.VersionError:
 pass
 
 try:

And, by the way, I just had a brain fart, and sent a stupid e-mail on the
same subject. I am not sure where it went, but please disregard it.

Cheers;

Gaël

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] crazy ideas for MPL

2009-07-10 Thread Robert Kern
On 2009-07-09 23:19, Andrew Straw wrote:
> Erik Tollerud wrote:

>> 2. Installation of traits or traitsgui should not be a necessity for
>> MPL... perhaps this will change in the future, but it's currently a
>> far bigger task to get traits and traits UI working on an arbitrary
>> system than it is to get MPL up and running (at least, that's been my
>> experience in a number of different settings).
>>
> Well, I don't think we need traits UI, and I don't imagine traits itself
> is hard to build, although I could be wrong (I always use the
> Ubuntu/Debian packages).

Traits itself is pretty trivial. There is one C extension that has no library 
dependencies like libfreetype.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Fixing matplotlib for wxPython 2.8

2009-07-10 Thread Gael Varoquaux
On Fri, Jul 10, 2009 at 08:12:14AM -1000, Eric Firing wrote:
> Gael Varoquaux wrote:
>> It seems that matplotlib needs the following patch for wxPython 2.8
>> (traceback hard to replicate, as you need to import wx before importing
>> matplotlib):

>> Index: lib/matplotlib/backends/backend_wx.py
>> ===
>> --- lib/matplotlib/backends/backend_wx.py   (revision 7250)
>> +++ lib/matplotlib/backends/backend_wx.py   (working copy)
>> @@ -117,7 +117,7 @@
>>   try:
>>  wxversion.ensureMinimal('2.8')
>> -except wxversion.AlreadyImportedError:
>> +except wxversion.VersionError:
>>  pass
>>   try:
>
> No, that is not a good solution:
> http://www.mail-archive.com/[email protected]/msg05003.html

OK, but right now MPL is broken with my version of wxversion, which is the
one shipped by default in Ubuntu. So it is broken for a lot of user.

It seems wrong for me to require the users to upgrade wxversion while
there is a solution that works, eventhough it may not be exactly what you
want.

One solution is to do bugware with hasattr(wxversion, 'AlreadyImportedError')

Gaël

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Fixing matplotlib for wxPython 2.8

2009-07-10 Thread Eric Firing
Gael Varoquaux wrote:
> It seems that matplotlib needs the following patch for wxPython 2.8
> (traceback hard to replicate, as you need to import wx before importing
> matplotlib):
> 
> Index: lib/matplotlib/backends/backend_wx.py
> ===
> --- lib/matplotlib/backends/backend_wx.py   (revision 7250)
> +++ lib/matplotlib/backends/backend_wx.py   (working copy)
> @@ -117,7 +117,7 @@
>  
>  try:
>  wxversion.ensureMinimal('2.8')
> -except wxversion.AlreadyImportedError:
> +except wxversion.VersionError:
>  pass
>  
>  try:

No, that is not a good solution:
http://www.mail-archive.com/[email protected]/msg05003.html

Eric

> 
> And, by the way, I just had a brain fart, and sent a stupid e-mail on the
> same subject. I am not sure where it went, but please disregard it.
> 
> Cheers;
> 
> Gaël
> 
> --
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel



--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Fixing matplotlib for wxPython 2.8

2009-07-10 Thread Eric Firing
Gael Varoquaux wrote:
> On Fri, Jul 10, 2009 at 08:12:14AM -1000, Eric Firing wrote:
>> Gael Varoquaux wrote:
>>> It seems that matplotlib needs the following patch for wxPython 2.8
>>> (traceback hard to replicate, as you need to import wx before importing
>>> matplotlib):
> 
>>> Index: lib/matplotlib/backends/backend_wx.py
>>> ===
>>> --- lib/matplotlib/backends/backend_wx.py   (revision 7250)
>>> +++ lib/matplotlib/backends/backend_wx.py   (working copy)
>>> @@ -117,7 +117,7 @@
>>>   try:
>>>  wxversion.ensureMinimal('2.8')
>>> -except wxversion.AlreadyImportedError:
>>> +except wxversion.VersionError:
>>>  pass
>>>   try:
>> No, that is not a good solution:
>> http://www.mail-archive.com/[email protected]/msg05003.html
> 
> OK, but right now MPL is broken with my version of wxversion, which is the
> one shipped by default in Ubuntu. So it is broken for a lot of user.

Are you sure?  Could you be pulling in some other wxversion?  The only 
other person reporting this problem so far is Tony Yu. I am now on 
jaunty, and my wxversion has AlreadyImportedError.  What version of 
ubuntu are you using, and what is the full wx version that it includes?

> 
> It seems wrong for me to require the users to upgrade wxversion while
> there is a solution that works, eventhough it may not be exactly what you
> want.

The solution you propose doesn't work.  It completely defeats the 
version check.

> 
> One solution is to do bugware with hasattr(wxversion, 'AlreadyImportedError')

Committed to svn.  Please check it.


Eric

> 
> Gaël
> 
> --
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel



--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Fixing matplotlib for wxPython 2.8

2009-07-10 Thread Gael Varoquaux
On Fri, Jul 10, 2009 at 09:41:30AM -1000, Eric Firing wrote:
>> OK, but right now MPL is broken with my version of wxversion, which is the
>> one shipped by default in Ubuntu. So it is broken for a lot of user.
>
> Are you sure?  Could you be pulling in some other wxversion?  The only  
> other person reporting this problem so far is Tony Yu. I am now on  
> jaunty, and my wxversion has AlreadyImportedError.  What version of  
> ubuntu are you using, and what is the full wx version that it includes?

Ha, interesting:

$ ipython   
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 
Type "copyright", "credits" or "license" for more information.

IPython 0.10.bzr.r1163 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import wxversion

In [2]: wxversion.__file__
Out[2]: '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode/wxversion.pyc'

So, if wx2.6 is installed (I have 2.8 installed too), we run into these
problem.

Also, it is interesting to see that the older wxversion gets imported.
That does defeat the purpose of wxversion :). It means that you can't
have multiple versions of wx installed.

>> It seems wrong for me to require the users to upgrade wxversion while
>> there is a solution that works, eventhough it may not be exactly what you
>> want.
>
> The solution you propose doesn't work.  It completely defeats the  
> version check.

In a way it does. So we can add a check:

"if 'wx' in sys.module:"

to replace the "AlreadyImportedError", it is clearly bug ware.

>> One solution is to do bugware with hasattr(wxversion, 'AlreadyImportedError')
>
> Committed to svn.  Please check it.

Certainly does work betters. Also, the "AlreadyImported" problem is
caught elsewhere if I preimport an older version of wx:

File "/home/varoquau/dev/matplotlib/lib/pylab.py", line 1, in 
from matplotlib.pylab import *
  File "/home/varoquau/dev/matplotlib/lib/matplotlib/pylab.py", line 244,
in 
from matplotlib.pyplot import *
  File "/home/varoquau/dev/matplotlib/lib/matplotlib/pyplot.py", line 76,
in 
new_figure_manager, draw_if_interactive, show = pylab_setup()
  File
"/home/varoquau/dev/matplotlib/lib/matplotlib/backends/__init__.py", line
25, in pylab_setup
globals(),locals(),[backend_name])
  File
"/home/varoquau/dev/matplotlib/lib/matplotlib/backends/backend_wxagg.py",
line 23, in 
import backend_wx# already uses wxversion.ensureMinimal('2.8')
  File
"/home/varoquau/dev/matplotlib/lib/matplotlib/backends/backend_wx.py",
line 137, in 
raise ImportError(missingwx)
ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8

Thanks for your fix.

Gaël

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Fixing matplotlib for wxPython 2.8

2009-07-10 Thread Gael Varoquaux
On Fri, Jul 10, 2009 at 11:05:24PM +0200, Gael Varoquaux wrote:
> > Committed to svn.  Please check it.

> Certainly does work betters. 

Actually, I beg your pardon, but it does not really work: if you have
2.6 and 2.8 installed, it will still import 2.6, which is not what you
want.

Here is a patch that works a bit better: it does import 2.8 even when 2.6
is installed:

Index: lib/matplotlib/backends/backend_wx.py
===
--- lib/matplotlib/backends/backend_wx.py   (revision 7251)
+++ lib/matplotlib/backends/backend_wx.py   (working copy)
@@ -124,6 +124,12 @@
 else:
 warnings.warn(
 "Update your wxversion.py to one including
AlreadyImportedError")
+try:
+wxversion.ensureMinimal('2.8')
+except wxversion.VersionError:
+pass
+
+
 
 try:
 import wx

Thanks for your work,

Gaël

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Fixing matplotlib for wxPython 2.8

2009-07-10 Thread Eric Firing
Gael Varoquaux wrote:
> On Fri, Jul 10, 2009 at 11:05:24PM +0200, Gael Varoquaux wrote:
>>> Committed to svn.  Please check it.
> 
>> Certainly does work betters. 
> 
> Actually, I beg your pardon, but it does not really work: if you have
> 2.6 and 2.8 installed, it will still import 2.6, which is not what you
> want.
> 
> Here is a patch that works a bit better: it does import 2.8 even when 2.6
> is installed:

Committed, thank you.

Eric

> 
> Index: lib/matplotlib/backends/backend_wx.py
> ===
> --- lib/matplotlib/backends/backend_wx.py   (revision 7251)
> +++ lib/matplotlib/backends/backend_wx.py   (working copy)
> @@ -124,6 +124,12 @@
>  else:
>  warnings.warn(
>  "Update your wxversion.py to one including
> AlreadyImportedError")
> +try:
> +wxversion.ensureMinimal('2.8')
> +except wxversion.VersionError:
> +pass
> +
> +
>  
>  try:
>  import wx
> 
> Thanks for your work,
> 
> Gaël



--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel