Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#2558 closed defect (fixed)

wxgui: profile surface map, bivariate scatter plot, histogram of raster map broken with wxPython 3.0.2 but work fine fine with 2.8

Reported by: humu2015 Owned by: grass-dev@…
Priority: major Milestone: 6.4.6
Component: wxGUI Version: 6.4.5
Keywords: wxgui Cc: msieczka
CPU: All Platform: All

Description (last modified by martinl)

The command console gives this output:

Traceback (most recent call last):
  File "/opt/grass64/etc/wxpython/mapdisp/frame.py", line
1026, in OnProfile

win = ProfileFrame(parent = self, rasterList = raster)
  File "/opt/grass64/etc/wxpython/wxplot/profile.py", line
48, in __init__

BasePlotFrame.__init__(self, parent, size = size, **kwargs)
  File "/opt/grass64/etc/wxpython/wxplot/base.py", line 85,
in __init__

self.client = plot.PlotCanvas(self)
  File "/usr/lib64/python2.7/site-
packages/wx-3.0-gtk2/wx/lib/plot.py", line 598, in __init__

self.HandCursor = wx.Cursor(Hand.GetImage())
  File "/usr/lib64/python2.7/site-
packages/wx-3.0-gtk2/wx/_gdi.py", line 1510, in __init__

_gdi_.Cursor_swiginit(self,_gdi_.new_Cursor(*args,
**kwargs))
TypeError
:
Required argument 'type' (pos 2) not found''''

Change History (23)

comment:1 Changed 4 years ago by martinl

Component: DefaultwxGUI
Description: modified (diff)

comment:2 Changed 4 years ago by annakrat

I am not sure if we can do anything about this: http://trac.wxwidgets.org/ticket/16767

comment:3 Changed 4 years ago by martinl

Milestone: 6.4.5

Ticket retargeted after milestone closed

comment:4 Changed 4 years ago by martinl

Milestone: 6.4.6

comment:5 in reply to:  2 Changed 4 years ago by mlennert

Replying to annakrat:

I am not sure if we can do anything about this: http://trac.wxwidgets.org/ticket/16767

This is still and issue (including on grass7). The wx issues seem to have been fixed [1], but in until these are released in a new version 3.0.3 the histogram tool is completely unusable ! Is there really no temporary workaround ?

[1] https://github.com/wxWidgets/wxPython/commits/master/wx/lib/plot.py

comment:6 Changed 4 years ago by mlennert

This is really getting to be very frustrating: I cannot use any of the gui tools with my students (g.gui.iclass, histogram, profile) because of this bug.

I tried to locally patch my wxpython install with the modifications in the above link, but this leads to other errors.

Is there really no other solution than to wait for the next release ? This makes many very nice GUI features completely unusable.

comment:7 in reply to:  6 ; Changed 4 years ago by annakrat

Replying to mlennert:

Is there really no other solution than to wait for the next release ? This makes many very nice GUI features completely unusable.

The only solution I can see (beside rewriting it using matplotlib) is to copy and integrate the particular code with the fix in GRASS. Licence should be OK I hope. I can try to do that, but I fear I run into problems with different versions of wxPython on different computers. Do we know for which versions the code has this bug?

comment:8 in reply to:  7 Changed 4 years ago by mlennert

Replying to annakrat:

Replying to mlennert:

Is there really no other solution than to wait for the next release ? This makes many very nice GUI features completely unusable.

The only solution I can see (beside rewriting it using matplotlib) is to copy and integrate the particular code with the fix in GRASS. Licence should be OK I hope. I can try to do that, but I fear I run into problems with different versions of wxPython on different computers. Do we know for which versions the code has this bug?

AFAICT, it's only wxpython 3.0.2. The commit that the above patch corrects dates from Oct. 2014 [1], i.e. between the releases of 3.0.1.1 and 3.0.2 [2].

I actually tried to apply the proposed patch locally to my wxpython installation. I didn't get the same error messages in GRASS anymore, but others. But I currently have no time to investigate this any further. Sorry...

[1] http://trac.wxwidgets.org/changeset/77995/svn-wx [2] http://www.wxpython.org/

comment:9 Changed 3 years ago by cmbarton

Here is a recent stack exchange for this problem. Supposedly it is fixed in wxPython 3.0.3.

http://stackoverflow.com/questions/30383786/wxpython-wx-lib-plot-plotcanvas-error

And here is the patch to fix plot.py.

http://trac.wxwidgets.org/attachment/ticket/16767/wxPython-3.0.2.0-plot.patch

I'll do this in my version of wxPython 3.0.2.0 and repackage GRASS 7.1 64 bit as a work around. If there is a way to fix this in our own code, it would be better.

Last edited 3 years ago by cmbarton (previous) (diff)

comment:10 Changed 3 years ago by msieczka

Cc: msieczka added
CPU: UnspecifiedAll
Keywords: wxgui added
Platform: LinuxAll
Priority: criticalmajor
Summary: The 'Profile Surfae Map' tool does not function.wxgui: profile surface map, bivariate scatter plot, histogram of raster map broken with wxPython 3.0.2 but work fine fine with 2.8
Version: unspecified7.0.4

No such error when wxgui uses wxPython 2.8 instead of 3.0.2. If you can't install 2.8 without 3.0.2 (like on Arch Linux, where 2.8 package requires 3.0.2 package), add

wxversion.select('2.8')

in line 64 of gui/wxpython/core/globalvar.py to force wxgui to pick version 2.8. Otherwise it defaults to 3.0.2 when both wxPython versions are available.

Any objections to submitting this patch to SVN?

The issue applies to both 7.x and 6.x. The "Create bivariate scatter plot of raster maps" and "Create histogram of raster map" tools are affected as well, and the wxversion.select('2.8') fixes them too.

comment:11 Changed 3 years ago by annakrat

I don't think selecting 2.8 is a good solution. I suggest copying the plot.py file from wx and distribute it with GRASS gui.

comment:12 in reply to:  11 ; Changed 3 years ago by msieczka

Replying to annakrat:

I don't think selecting 2.8 is a good solution.

Can you explain why you think so?

I suggest copying the plot.py file from wx and distribute it with GRASS gui.

How exactly? Which particular https://github.com/wxWidgets/wxPython/commits/master/wx/lib/plot.py version would you use?

mlennert complained about some other errors taking place when he tried it. I wish we knew what he did and what were those errors.

comment:13 Changed 3 years ago by cmbarton

One reason to keep available the possibility of using wxPython 3.0.2 (or Phoenix when it is developed to a place where it is useable), is that 2.8 is 32 bit only on the Mac. Maybe on other platforms too.

However, most other parts of GRASS and its dependencies have migrated to 64 bit architecture. This is causing all kinds of difficulties in compiling because it has to be done dual architecture (32/64 bit) and some programs do not support this or don't support it well.

I'm trying to find out where the problems in wxPython 3 are so that they can be fixed. The plot.py problem was the worst but is easily patched.

comment:14 in reply to:  13 Changed 3 years ago by msieczka

Replying to cmbarton:

One reason to keep available the possibility of using wxPython 3.0.2 (or Phoenix when it is developed to a place where it is useable), is that 2.8 is 32 bit only on the Mac.

Thanks for explaining this. What would it take to have wxPython 2.8 64bit for Mac GRASS build?

Maybe on other platforms too.

I don't know about any such either.

I'm trying to find out where the problems in wxPython 3 are so that they can be fixed. The plot.py problem was the worst but is easily patched.

Good luck!

comment:15 in reply to:  12 Changed 3 years ago by mlennert

Replying to msieczka:

Replying to annakrat:

I don't think selecting 2.8 is a good solution.

Can you explain why you think so?

I suggest copying the plot.py file from wx and distribute it with GRASS gui.

How exactly? Which particular https://github.com/wxWidgets/wxPython/commits/master/wx/lib/plot.py version would you use?

mlennert complained about some other errors taking place when he tried it. I wish we knew what he did and what were those errors.

I locally applied the patch at [1], but as I said this led to other errors and I did not have time to pursue. And, no, I didn't record the other errors, just gave up...

[1] http://trac.wxwidgets.org/changeset/77995/svn-wx

comment:16 Changed 3 years ago by mlennert

Actually, the original problem I had (TypeError?: Required argument 'type' (pos 2) not found) seems to have been solved in the latest python-wx package in Debian (3.0.2.0+dfsg-3). However, I now get the problem reported in #3112, so maybe these two bug reports should be merged...

comment:17 Changed 3 years ago by annakrat

Milestone: 6.4.67.0.5
Resolution: fixed
Status: newclosed

Fixed in r69075 (and backported in r69076 and r69077). wxPython file wx.lib.plot.py (the fixed version, see http://trac.wxwidgets.org/ticket/16767) is now distributed with GRASS and modified to workaround this bug specific for wxGTK only: http://trac.wxwidgets.org/ticket/17293

comment:18 in reply to:  17 ; Changed 3 years ago by msieczka

Milestone: 7.0.56.4.6
Resolution: fixed
Status: closedreopened
Version: 7.0.46.4.5

Replying to annakrat:

Fixed in r69075 (and backported in r69076 and r69077).

Great. But releasebranch_6_4 is still affected. Re-opening.

comment:19 in reply to:  18 ; Changed 3 years ago by mlennert

Replying to msieczka:

Replying to annakrat:

Fixed in r69075 (and backported in r69076 and r69077).

Great. But releasebranch_6_4 is still affected. Re-opening.

AFAIK, only profile is concerned by this in grass64.

Applying the relevant patches to gui/wxpython/wxplot/base.py and gui/wxpython/wxplot/profile.py

makes it work for me.

Anna, AFAICT this should be safe, but what do you think ?

comment:20 in reply to:  19 ; Changed 3 years ago by annakrat

Replying to mlennert:

AFAIK, only profile is concerned by this in grass64.

Applying the relevant patches to gui/wxpython/wxplot/base.py and gui/wxpython/wxplot/profile.py

makes it work for me.

Anna, AFAICT this should be safe, but what do you think ?

I think so. Please go ahead and commit it.

comment:21 Changed 3 years ago by mlennert

Resolution: fixed
Status: reopenedclosed

In 69213:

wxGUI: fix #2558 (backport from grass7)

comment:22 in reply to:  20 ; Changed 3 years ago by mlennert

Replying to annakrat:

Replying to mlennert:

AFAIK, only profile is concerned by this in grass64.

Applying the relevant patches to gui/wxpython/wxplot/base.py and gui/wxpython/wxplot/profile.py

makes it work for me.

Anna, AFAICT this should be safe, but what do you think ?

I think so. Please go ahead and commit it.

Done.

Maciej, could you test ?

comment:23 in reply to:  22 Changed 3 years ago by msieczka

Replying to mlennert:

Done.

Maciej, could you test ?

It's all OK as of 6.4.6 release. Thanks!

Note: See TracTickets for help on using tickets.