grass icon indicating copy to clipboard operation
grass copied to clipboard

[Bug] Single-Window GUI not opening (Ubuntu Linux)

Open CarlosGrohmann opened this issue 3 years ago • 7 comments
trafficstars

Describe the bug Single-window GUI does not open

To Reproduce Open GRASS. Opens in multi-window GUI. Go to Settings - check single-window GUI option. Exit GRASS Start GRASS GUI doesn't open. Need to delete .grass dir in order to get it working again in multi-window mode

Error messages:

Welcome to GRASS GIS 8.3.dev (2af9d79ab)
GRASS GIS homepage:                      https://grass.osgeo.org
This version running through:            Bash Shell (/bin/bash)
Help is available with the command:      g.manual -i
See the licence terms with:              g.version -c
See citation options with:               g.version -x
If required, restart the GUI with:       g.gui wxpython
When ready to quit enter:                exit

Launching <wxpython> GUI in the background, please wait...
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

GRASS world_latlong_wgs84/PERMANENT:~ > /usr/local/grass/grass83/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/wx/core.py", line 3282, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "/usr/local/grass/grass83/gui/wxpython/wxgui.py", line 95, in show_main_gui
    mainframe = GMFrame(parent=None, id=wx.ID_ANY, workspace=self.workspaceFile)
  File "/usr/local/grass/grass83/gui/wxpython/main_window/frame.py", line 164, in __init__
    self.BuildPanes()
  File "/usr/local/grass/grass83/gui/wxpython/main_window/frame.py", line 645, in BuildPanes
    self._auimgr.AddPane(
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/framemanager.py", line 4711, in AddPane
    return self.AddPane4(window, arg1, target)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/framemanager.py", line 4879, in AddPane4
    self.UpdateNotebook()
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/framemanager.py", line 6653, in UpdateNotebook
    notebook.AddPage(pane.window, title, True, pane.icon)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 3575, in AddPage
    return self.InsertPage(self.GetPageCount(), page, caption, select, bitmap, disabled_bitmap, control, tooltip)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 3653, in InsertPage
    self.SetSelectionToWindow(page)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 4410, in SetSelectionToWindow
    self.SetSelection(idx)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 4357, in SetSelection
    ctrl.MakeTabVisible(ctrl_idx, ctrl)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 1843, in MakeTabVisible
    if not self.IsTabVisible(tabPage, self.GetTabOffset(), dc, win):
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 1732, in IsTabVisible
    self.Render(dc, wnd)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 1687, in Render
    page.rect, tab_button.rect, x_extent = self._art.DrawTab(dc, wnd, page, rect, tab_button.cur_state)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/tabart.py", line 475, in DrawTab
    r.SetHeight(r.GetHeight()/2)
TypeError: Rect.SetHeight(): argument 1 has unexpected type 'float'

Expected behavior The single-window GUI should open

System description (please complete the following information):

  • Operating System: Linux Ubuntu 22.04
  • GRASS GIS version 8.2.0 from ubuntugis and 8.3 compiled locally
  • Python and wxPython version numbers:
  • 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]
  • 4.0.7 gtk3 (phoenix) wxWidgets 3.0.5

CarlosGrohmann avatar Jun 26 '22 17:06 CarlosGrohmann

WxWidgets magic or crappy thing ... I wonder why releasing grass version with new version of wxWidgets never published exists

I had same issue on archlinux You need this patch : https://github.com/wxWidgets/Phoenix/commit/7afcc7fbc68506b55b5bb85970871a5f3df6eac4 And may be others, I pushed here what's work at this time (new to come in several weeks as usual) : https://aur.archlinux.org/packages/python-wxpython-dev

kikislater avatar Jun 27 '22 06:06 kikislater

Problematic is newer Python 3.10.4 version with combination wxPython 4.0.7 gtk3 (phoenix) wxWidgets 3.0.5 version. With Python 3.9.13 and wxPython '4.0.7.post2 gtk3 (phoenix) wxWidgets 3.0.5' works wxGUI single-windows mode as expected.

tmszi avatar Jun 27 '22 09:06 tmszi

@CarlosGrohmann Quick fix without apply patches and self compilation wxPython. I build Python wheel binary wxPython '4.1.2a1 gtk3 (phoenix) wxWidgets 3.1.7' version package for easy installation (you can download wxPython wheel binary package by clicking on the link) for your distribution Ubuntu 22.04, with this version single-window mode works correctly.

Installation/launch procedure:

osboxes@osboxes:~$ sudo apt-get install python3-virtualenv python3-pip

# Create isolated Python virtual environment root directory venv
osboxes@osboxes:~$ mkdir $HOME/venv

# Create isolated Python virtual environment grass_gis_wxpy_41
osboxes@osboxes:~$ virtualenv $HOME/venv/grass_gis_wxpy_41

# Activate isolated Python virtual environment grass_gis_wxpy_41
osboxes@osboxes:~$ source $HOME/venv/grass_gis_wxpy_41/bin/activate

# Install binary wxPython wheel package, change download directory if it is different please
(grass_gis_wxpy_41) osboxes@osboxes:~$ pip install $HOME/Downloads/wxPython-4.1.2a1-cp310-cp310-linux_x86_64.whl 

# Launch GRASS GIS
(grass_gis_wxpy_41) osboxes@osboxes:~$ grass

# After you quit GRASS GIS session deactivate isolated Python virtual environment grass_gis_wxpy_41
(grass_gis_wxpy_41) osboxes@osboxes:~$ deactivate

tmszi avatar Jun 27 '22 18:06 tmszi

Slightly but hopefully not completely OT, @tmszi where did you get the Linux wheel snapshot you link in your post? The official snapshot repository does not seem to have Linux wheels, only windows and Mac.

dhdeangelis avatar Jun 28 '22 14:06 dhdeangelis

Slightly but hopefully not completely OT, @tmszi where did you get the Linux wheel snapshot you link in your post? The official snapshot repository does not seem to have Linux wheels, only windows and Mac.

It isn't official wxPython wheel package. I compiled wxPython myself to create a binary wheel package wxPython-4.1.2a1-cp310-cp310-linux_x86_64.whl and upload to transfer file sharing service (link in comment above) for GNU/Linux.

tmszi avatar Jun 28 '22 14:06 tmszi

Slightly but hopefully not completely OT, @tmszi where did you get the Linux wheel snapshot you link in your post? The official snapshot repository does not seem to have Linux wheels, only windows and Mac.

That's the point. Totally weird

kikislater avatar Jul 04 '22 18:07 kikislater

So they released wxWidgets 3.20 ! https://github.com/wxWidgets/wxWidgets/releases/tag/v3.2.0

Making wxPython 4.1.1 totally outdated as it needs lot of patches but comes in replacement from 4.0.7post2 as it couldn't work with this version ... May be one day they will release a new version of wxPython ...

kikislater avatar Jul 23 '22 17:07 kikislater

FIY: https://github.com/wxWidgets/Phoenix/releases/tag/wxPython-4.2.0 been released 4 days ago.

neteler avatar Aug 17 '22 18:08 neteler

Works in openSUSE Tumbleweed again. wxPython has been updated, is now 4.2.0.

dhdeangelis avatar Aug 18 '22 12:08 dhdeangelis

There is not much to do on our side and new wxPython is released and available on Ubuntu:

pip install -U https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04/ wxPython

petrasovaa avatar Aug 23 '22 10:08 petrasovaa