Opened 9 years ago

Closed 8 years ago

#36904 closed defect (fixed)

grass: allow building against wxWidgets-2.8 and wxgtk-2.8

Reported by: drew.mueller@… Owned by: g5pw (Aljaž Srebrnič)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cooljeanius (Eric Gallager), vaccari@…, manuel.deljesuspe@…, mojca (Mojca Miklavec), drew.mueller@…, ryandesign (Ryan Schmidt)
Port: grass

Description (last modified by mf2k (Frank Schima))

the grass port is missing the wxPython variant, and therefore when I start up grass I get the following error message:

"Starting GRASS ...
ERROR: wxGUI requires wxPython. No module named wxversion
Error in GUI startup. If necessary, please
report this error to the GRASS developers.
Switching to text mode now.
Hit RETURN to continue..."

I have tried installing the wxPython port and some others, but have not been able to get the GUI to work. Can you please either help me or add a variant to install the necessary wxPython when porting grass. Thanks so much!

Change History (20)

comment:1 Changed 9 years ago by mf2k (Frank Schima)

Description: modified (diff)
Keywords: grass gis wxpython removed
Summary: grass port missing wxPython variant, no GUIgrass: add wxPython variant
Type: defectenhancement
Version: 2.1.2

In the future, please use WikiFormatting.

comment:2 Changed 9 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:3 Changed 9 years ago by vaccari@…

Cc: vaccari@… added

Cc Me!

comment:4 Changed 9 years ago by vaccari@…

I tried the following:

1) installed both py-wxpython30 and py27-wxpython30

2) rebuilt grass and still obtain message about missing wxversion upon launch

3) check that wxversion is actually installed

du -a | grep wxversion
40	/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wxversion.py
32	/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wxversion.pyc

4) and obtain:

sudo python /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wxversion.py
['2.9.4-osx_cocoa',
 '2.7.1-gtk2-ansi',
 '2.6-gtk2-unicode',
 '2.6-gtk2-ansi',
 '2.6-gtk-ansi',
 '2.5.3-gtk-ansi',
 '2.5.2-gtk2-unicode',
 '2.4-gtk-ansi']
True
True
False
Current sys.path:
['/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
 '/Library/Python/2.7/site-packages',
 '/tmp']

Asked for 2.4, (False):	 got: /tmp/wx-2.4-gtk-ansi
Asked for 2.5, (False):	 got: /tmp/wx-2.5.3-gtk-ansi
Asked for 2.5-gtk2, (False):	 got: /tmp/wx-2.5.2-gtk2-unicode
Asked for 2.5.2, (False):	 got: /tmp/wx-2.5.2-gtk2-unicode
Asked for 2.5-ansi, (False):	 got: /tmp/wx-2.5.3-gtk-ansi
Asked for 2.5-unicode, (False):	 got: /tmp/wx-2.5.2-gtk2-unicode
Asked for 2.6, (False):	 got: /tmp/wx-2.6-gtk2-unicode
Asked for 2.6-ansi, (False):	 got: /tmp/wx-2.6-gtk2-ansi
Asked for ['2.6-unicode', '2.7-unicode'], (False):	 got: /tmp/wx-2.6-gtk2-unicode
Asked for ['2.6', '2.7'], (False):	 got: /tmp/wx-2.7.1-gtk2-ansi
Asked for ['2.6-unicode', '2.7-unicode'], (True):	 got: /tmp/wx-2.6-gtk2-unicode
Asked for 2.4-unicode, (False):	 got: /tmp/wx-2.4-gtk-ansi
Asked for ['2.5.2', '2.5.3', '2.6'], (False):	 got: /tmp/wx-2.6-gtk2-unicode
Asked for 2.9, (False):	 got: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa
Asked for incompatible versions, got Exception: A previously selected wx version does not match the new request.
EM: Asked for 2.6, (False):	 got: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa
EM: Asked for 2.6-unicode, (False):	 got: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa
EM: Asked for 2.6-unicode, (True):	 got: /tmp/wx-2.6-gtk2-unicode
EM: Asked for 2.9, (False):	 got: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa

So now I don't know how to tell grass to use it...

comment:5 Changed 9 years ago by manuel.deljesuspe@…

Cc: manuel.deljesuspe@… added

Cc Me!

comment:6 Changed 9 years ago by vaccari@…

I see that people at homebrew apparently solved the issue

+# So, problem with wxWidgets is that the developers have not released a stable
+# version that builds x86_64 for OS X.  So, in order to use the nice GUI for
+# GRASS, we have to ensure the system python is used and ensure it starts in 32
+# bit mode.
+export VERSIONER_PYTHON_PREFER_32_BIT=yes
+export GRASS_PYTHON=/usr/bin/pythonw

How to do the same in MacPorts?

comment:7 in reply to:  6 Changed 9 years ago by larryv (Lawrence Velázquez)

Replying to vaccari@…:

I see that people at homebrew apparently solved the issue

https://github.com/mxcl/homebrew/blob/master/Library/Formula/grass.rb#L147

comment:8 Changed 8 years ago by g5pw (Aljaž Srebrnič)

This should be fixed in r106731. Feel free to reopen if it still doesn't work.

comment:9 Changed 8 years ago by g5pw (Aljaž Srebrnič)

Owner: changed from macports-tickets@… to g5pw@…

comment:10 in reply to:  8 Changed 8 years ago by vaccari@…

Replying to g5pw@…:

This should be fixed in r106731. Feel free to reopen if it still doesn't work.

I've removed grass, reinstalled with +wxPython and +wxWidgets

--->  Computing dependencies for grass
--->  Fetching archive for grass
--->  Attempting to fetch grass-6.4.2_3+wxPython+wxwidgets.darwin_12.x86_64.tbz2 from http://lil.fr.packages.macports.org/grass
--->  Attempting to fetch grass-6.4.2_3+wxPython+wxwidgets.darwin_12.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/grass
--->  Attempting to fetch grass-6.4.2_3+wxPython+wxwidgets.darwin_12.x86_64.tbz2 from http://packages.macports.org/grass
--->  Fetching distfiles for grass
--->  Verifying checksum(s) for grass
--->  Extracting grass
--->  Applying patches to grass
--->  Configuring grass
--->  Building grass
--->  Staging grass into destroot
--->  Installing grass @6.4.2_3+wxPython+wxwidgets
--->  Deactivating grass @6.4.2_3+wxwidgets
--->  Cleaning grass
--->  Activating grass @6.4.2_3+wxPython+wxwidgets
--->  Cleaning grass
--->  Updating database of binaries: 100.0%
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.

but still I'm getting the error when starting grass64

Hit RETURN to continue

Starting GRASS ...
ERROR: wxGUI requires wxPython. No module named wxversion
Error in GUI startup. If necessary, please
report this error to the GRASS developers.
Switching to text mode now.
Hit RETURN to continue...

Is there any other step that I should take? Or anything else that I could try that could help in tracking the problem?

Thanks for looking into it!

comment:11 Changed 8 years ago by g5pw (Aljaž Srebrnič)

Try starting grass like this

PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ grass64

and see if it works. (I assume your prefix is /opt/local)

comment:12 in reply to:  11 Changed 8 years ago by vaccari@…

Tried (both in bash and in tcsh using setenv), no change...

comment:13 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:14 Changed 8 years ago by mojca (Mojca Miklavec)

I solved this particular problem by defining

export GRASS_PYTHON=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

and this definition could easily be added to

/opt/local/bin/grass64 

but the program had problems later with

/opt/local/share/grass-6.4.2/etc/wxpython/gis_set.py:864: wxPyDeprecationWarning: Call to deprecated item 'InitAllImageHandlers'. 
  wx.InitAllImageHandlers()
2013-08-22 18:28:46.448 Python[6642:f07] Invalid URL passed to an open/save panel: '(null)'.  Using 'file:///.file/id=6562758.281193/' instead.
2013-08-22 18:29:17.672 Python[6642:f07] -_continuousScroll is deprecated for NSScrollWheel. Please use -hasPreciseScrollingDeltas.
2013-08-22 18:29:17.673 Python[6642:f07] -deviceDeltaX is deprecated for NSScrollWheel. Please use -scrollingDeltaX.
2013-08-22 18:29:17.674 Python[6642:f07] -deviceDeltaY is deprecated for NSScrollWheel. Please use -scrollingDeltaY.
Traceback (most recent call last):
  File "/opt/local/share/grass-6.4.2/etc/wxpython/gis_set.py", line 411, in OnWizard
    grassdatabase = self.tgisdbase.GetValue())
  File "/opt/local/share/grass-6.4.2/etc/wxpython/gui_modules/location_wizard.py", line 1752, in __init__
    self.startpage = DatabasePage(self.wizard, self, grassdatabase)
  File "/opt/local/share/grass-6.4.2/etc/wxpython/gui_modules/location_wizard.py", line 142, in __init__
    self.sizer.AddGrowableCol(3)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/_core.py", line 15380, in AddGrowableCol
    return _core_.FlexGridSizer_AddGrowableCol(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "!m_cols || idx < (size_t)m_cols" failed at ../src/common/sizer.cpp(1956) in AddGrowableCol(): invalid column index

I was testing with wxPython 2.9.4.0.

comment:15 Changed 8 years ago by g5pw (Aljaž Srebrnič)

The error is probably because grass uses APIs deprecated in wxPython 2.9. Could you try with wxPython 2.8?

comment:16 Changed 8 years ago by mojca (Mojca Miklavec)

Yes, most probably this is related to incompatibilities with wxPython 2.9, but this means that the software needs to be fixed, sooner or later. The first few warnings related to mouse have already been fixed (in 2.9.5; the patches have also been backported to wxWidgets 2.9.4 port, but I forgot to add them to the new wxPython package and I will add them back now before switching the whole wxWidgets mess).

I've seen the error about m_cols before in other software.

Anyway, grass64 or whatever other files from grass need to be fixed to call the right Python. This is independent from the errors I encountered.

comment:17 Changed 8 years ago by drew.mueller@…

Cc: drew.mueller@… added

Cc Me!

comment:18 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: ryandesign@… added
Summary: grass: add wxPython variantgrass: allow building against wxWidgets-2.8 and wxgtk-2.8
Type: enhancementdefect

I upgraded the port to 6.4.3 in r110476 and fixed the reported problem:

ERROR: wxGUI requires wxPython. No module named wxversion

by adding

export GRASS_PYTHON=${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7

to ${prefix}/bin/grass64.

The problem now is that grass is not really compatible with wxPython 2.9, so the port needs a way to switch between wxWidgets-2.8, wxgtk-2.8 and wxPython-2.9 (the last one for experimental purposes only).

According to the notes above this might include adding

export VERSIONER_PYTHON_PREFER_32_BIT=yes

to ${prefix}/bin/grass64 when building for wxWidgets-2.8.

I could easily do this in the same spirit as for FileZilla:

variant wxwidgets30 conflicts wxgtk28 wxwidgets28 description {Use wxWidgets 2.9 (not fully functional yet)} {
    wxWidgets.use           wxPython-3.0
    depends_lib-append      port:${wxWidgets.port}
    configure.args-append   --with-wxdir=${wxWidgets.wxdir}
}

variant wxwidgets28 conflicts wxgtk28 wxwidgets30 description {Use 32-bit Carbon-based wxWidgets 2.8} {
    wxWidgets.use           wxWidgets-2.8
    depends_lib-append      port:${wxWidgets.port}
    configure.args-append   --with-wxdir=${wxWidgets.wxdir}
}

variant wxgtk28 conflicts wxwidgets28 wxwidgets30 description {Use wxWidgets 2.8 with GTK} {
    wxWidgets.use           wxGTK-2.8
    depends_lib-append      port:${wxWidgets.port}
    configure.args-append   --with-wxdir=${wxWidgets.wxdir}
}

if {![variant_isset wxwidgets30] && ![variant_isset wxwidgets28] && ![variant_isset wxgtk28]} {
    if {[vercmp $xcodeversion 4.4] >= 0} {
        default_variants +wxgtk28
    } else {
        default_variants +wxwidgets28
    }
}

however there is a serious problem with this. On OS X 10.7 and later this will default to the usage of py27-wxpython-2.8 which is incompatible with py27-wxpython-3.0. The only reasonable workaround for this is to use py26-wxpython-2.8 (or to use py26-wxpython-3.0 for all other ports) which means that the port will either be incompatible with other wxPython dependencies or it will also have to support multiple python versions (at least 2.6).

If would be great to have a maintainer for this port ...

comment:19 Changed 8 years ago by mojca (Mojca Miklavec)

See also #40333 for the same issue in other wxPython dependencies.

comment:20 Changed 8 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: newclosed

I committed some changes in r116076. Carbon-based wxWidgets 2.8 is not supported, but I added support for both Python 2.6 and 2.7 as well as for wxWidgets 3.0 and wxGTK 2.8. I believe this (and earlier changes) should address the issues reported here. (Compiling the port would probably fail if py-wxpython-2.8 +carbon is installed. I didn't check for that even though it would be a trivial fix that can always be added if necessary.)

Note: See TracTickets for help on using tickets.