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
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
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/mat...@li.../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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
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/mat...@li.../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
Gael Varoquaux wrote: > On Sat, Jul 11, 2009 at 12:49:03PM -0500, John Hunter wrote: >>> Can you do an 'import wxversion; print wxversion.__file__', so that we >>> understand better why you are getting these warnings. > >> In [1]: import wxversion > >> In [2]: print wxversion.__file__ >> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxversion.pyc > > Hell, sorry, I don't understand why you are getting the warning. > > Gaël OK, I tried again in svn 7256. I think this is a little cleaner. More diagnostic information could still be added to the exception messages if this is going to be a continuing problem. Eric
On Sat, Jul 11, 2009 at 08:10:23AM -1000, Eric Firing wrote: > OK, I tried again in svn 7256. I think this is a little cleaner. More > diagnostic information could still be added to the exception messages if > this is going to be a continuing problem. It seems to work for me in all the configurations I can think of (and does raises the error when 2.6 is imported instead of 2.8.). I could be forgetting configurations, as the combinatory is high. These things are hard problems, thanks for your work. Gaël
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/mat...@li.../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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
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 <module> from matplotlib.pylab import * File "/home/varoquau/dev/matplotlib/lib/matplotlib/pylab.py", line 244, in <module> from matplotlib.pyplot import * File "/home/varoquau/dev/matplotlib/lib/matplotlib/pyplot.py", line 76, in <module> 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 <module> import backend_wx # already uses wxversion.ensureMinimal('2.8') File "/home/varoquau/dev/matplotlib/lib/matplotlib/backends/backend_wx.py", line 137, in <module> raise ImportError(missingwx) ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8 Thanks for your fix. Gaël
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
Gael Varoquaux wrote: > On Sat, Jul 11, 2009 at 08:10:23AM -1000, Eric Firing wrote: >> OK, I tried again in svn 7256. I think this is a little cleaner. More >> diagnostic information could still be added to the exception messages if >> this is going to be a continuing problem. > > It seems to work for me in all the configurations I can think of (and > does raises the error when 2.6 is imported instead of 2.8.). I could be > forgetting configurations, as the combinatory is high. > > These things are hard problems, thanks for your work. Thank you for the testing and reporting. I don't normally use wx and I am not willing to fiddle with multiple versions of it, so I am working almost blind on this. Eric
On Sat, Jul 11, 2009 at 1:18 PM, Eric Firing<ef...@ha...> wrote: >> These things are hard problems, thanks for your work. > > Thank you for the testing and reporting. I don't normally use wx and I am > not willing to fiddle with multiple versions of it, so I am working almost > blind on this. This is working for me, and by working I mean not displaying the warning... Thanks Eric JDH
On Sat, Jul 11, 2009 at 08:18:25AM -1000, Eric Firing wrote: > Thank you for the testing and reporting. I don't normally use wx and I > am not willing to fiddle with multiple versions of it, so I am working > almost blind on this. I use wx a lot, and with MPL embedded in other programs, so I am a good test bed, and will hopefully catch major problems. However, I of course cover only the configurations I have installed on the various boxes I work on. One of the really nice things with MPL, is that there is a significant user base working from SVN, and thus catching problems early. Gaël
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
On Fri, Jul 10, 2009 at 4:33 PM, Eric Firing<ef...@ha...> wrote: > 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. I just updated mpl from svn and now get y:126: UserWarning: Update your wxversion.py to one including AlreadyImportedError "Update your wxversion.py to one including AlreadyImportedError") backend WXAgg version 2.8.3.0 If I can speak for the typical user, these kinds of warnings are usually annoying and not that helpful. I am a naive wx user -- I installed it many moons ago from a binary when I installed python and haven't thought about it since. I don't know what wxversion is or how to upgrade it. All I know is mpl was working fine, still works fine, and now generates an annoying warning. So I am not sure this is progress, but may help someone who has a complicated wx setup avoid difficult to trackdown bug. So I would prefer to silence this, but am not sure what the right solution is. Here is my wx installation In [6]: wx.__version__ Out[6]: '2.8.3.0' In [7]: !ls -ld /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx* drwxrwxr-x 5 root admin 170 Mar 22 2007 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode -rw-r--r-- 1 root admin 18 Mar 22 2007 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx.pth -rw-r--r-- 1 root admin 1266 Mar 22 2007 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxPython_common-2.8.3.0-py2.5.egg-info drwxr-xr-x 5 root admin 170 Mar 22 2007 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxaddons -rw-r--r-- 1 root admin 1259 Mar 22 2007 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxaddons-2.8.3.0-py2.5.egg-info -rw-r--r-- 1 root admin 17809 Mar 16 2006 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxversion.py -rw-r--r-- 1 jdhunter admin 15750 Mar 23 20:28 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxversion.pyc JDH
On Sat, Jul 11, 2009 at 12:38:13PM -0500, John Hunter wrote: > If I can speak for the typical user, these kinds of warnings are > usually annoying and not that helpful. I am a naive wx user -- I > installed it many moons ago from a binary when I installed python and > haven't thought about it since. I don't know what wxversion is or how > to upgrade it. All I know is mpl was working fine, still works fine, > and now generates an annoying warning. So I am not sure this is > progress, but may help someone who has a complicated wx setup avoid > difficult to trackdown bug. So I would prefer to silence this, but > am not sure what the right solution is. Here is my wx installation I am a bit like you. I believe these warning are not terribly helpful. Can you do an 'import wxversion; print wxversion.__file__', so that we understand better why you are getting these warnings. Cheers, Gaël
On Sat, Jul 11, 2009 at 12:43 PM, Gael Varoquaux<gae...@no...> wrote: > On Sat, Jul 11, 2009 at 12:38:13PM -0500, John Hunter wrote: >> If I can speak for the typical user, these kinds of warnings are >> usually annoying and not that helpful. I am a naive wx user -- I >> installed it many moons ago from a binary when I installed python and >> haven't thought about it since. I don't know what wxversion is or how >> to upgrade it. All I know is mpl was working fine, still works fine, >> and now generates an annoying warning. So I am not sure this is >> progress, but may help someone who has a complicated wx setup avoid >> difficult to trackdown bug. So I would prefer to silence this, but >> am not sure what the right solution is. Here is my wx installation > > I am a bit like you. I believe these warning are not terribly helpful. > > Can you do an 'import wxversion; print wxversion.__file__', so that we > understand better why you are getting these warnings. In [1]: import wxversion In [2]: print wxversion.__file__ /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxversion.pyc In [3]: import wx In [4]: print wx.__version__ 2.8.3.0 In [5]: print wx.__file__ /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/__init__.pyc In [6]: wxversion. wxversion.UPDATE_URL wxversion.__setattr__ wxversion.VersionError wxversion.__str__ wxversion._EM_DEBUG wxversion._find_default wxversion.__builtins__ wxversion._find_installed wxversion.__class__ wxversion._get_best_match wxversion.__delattr__ wxversion._pattern wxversion.__dict__ wxversion._selected wxversion.__doc__ wxversion._wxPackageInfo wxversion.__file__ wxversion.checkInstalled wxversion.__getattribute__ wxversion.ensureMinimal wxversion.__hash__ wxversion.fnmatch wxversion.__init__ wxversion.getInstalled wxversion.__name__ wxversion.glob wxversion.__new__ wxversion.os wxversion.__reduce__ wxversion.re wxversion.__reduce_ex__ wxversion.select wxversion.__repr__ wxversion.sys In [6]: wxversion.getInstalled? Type: function Base Class: <type 'function'> String Form: <function getInstalled at 0xe62e30> Namespace: Interactive File: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxversion.py Definition: wxversion.getInstalled() Docstring: Returns a list of strings representing the installed wxPython versions that are found on the system. In [7]: wxversion.getInstalled() Out[7]: ['2.8-mac-unicode']
On Sat, Jul 11, 2009 at 12:49:03PM -0500, John Hunter wrote: > > Can you do an 'import wxversion; print wxversion.__file__', so that we > > understand better why you are getting these warnings. > In [1]: import wxversion > In [2]: print wxversion.__file__ > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wxversion.pyc Hell, sorry, I don't understand why you are getting the warning. Gaël