Opened 5 years ago

Closed 5 years ago

#3962 closed defect (fixed)

GRASS 7.8.1 GUI doesn't run on Pop! OS 18.04 (Ubuntu 18.04) because of "ImportError: cannot import name 'NewIdRef'"

Reported by: rorschach Owned by: grass-dev@…
Priority: normal Milestone: 7.8.2
Component: wxGUI Version: git-releasebranch78
Keywords: Cc:
CPU: x86-64 Platform: Linux

Description

Hi everyone,

I installed GRASS 7.8.1 via the ubuntugis-unstable repository on my machine running Pop! OS 18.04 (based on Ubuntu 18.04). When I run GRASS, this error occurs:

Starting GRASS GIS...
Traceback (most recent call last):
  File "/usr/lib/grass78/gui/wxpython/gis_set.py", line 43, in <module>
    from startup.guiutils import SetSessionMapset, NewMapsetDialog
  File "/usr/lib/grass78/gui/wxpython/startup/guiutils.py", line 25, in <module>
    from gui_core.dialogs import TextEntryDialog
  File "/usr/lib/grass78/gui/wxpython/gui_core/dialogs.py", line 50, in <module>
    from gui_core.gselect import LocationSelect, MapsetSelect, Select, \
  File "/usr/lib/grass78/gui/wxpython/gui_core/gselect.py", line 64, in <module>
    from gui_core.widgets import ManageSettingsWidget, CoordinatesValidator
  File "/usr/lib/grass78/gui/wxpython/gui_core/widgets.py", line 92, in <module>
    from gui_core.wrap import Button, SearchCtrl, StaticText, StaticBox, \
  File "/usr/lib/grass78/gui/wxpython/gui_core/wrap.py", line 39, in <module>
    from wx import NewIdRef as NewId
ImportError: cannot import name 'NewIdRef'
ERROR: Error in GUI startup. See messages above (if any) and if necessary, please report this error to the GRASS developers.
On systems with package manager, make sure you have the right GUI package, probably named grass-gui, installed.
To run GRASS GIS in text mode use the --text flag.
Use '--help' for further options
     grass78 --help
See also: https://grass.osgeo.org/grass78/manuals/helptext.html
Exiting...

I checked the module in question (wx). The said module isn't available on the default Python (python2) of my machine.

Python 2.7.15+ (default, Oct  7 2019, 17:39:04) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named wx
>>> 

It is however available on my machine's Python 3.

Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.__version__
'4.0.1'
>>> 

When I try to import NewIdRef, it doesn't exist but NewId does.

Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> from wx import NewIdRef
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'NewIdRef'
>>> from wx import NewId
>>> 

Finally, GRASS text mode works. It really is just the GUI that fails.

Thanks everyone!

Change History (2)

comment:1 by neteler, 5 years ago

Unfortunately we missed to backport this PR:

https://github.com/OSGeo/grass/pull/155

There are two options now:

  • fix the Python file on your machine as per PR 155, or
  • wait for the GRASS GIS 7.8.2 release

See also the related discussion here:

https://lists.osgeo.org/pipermail/grass-user/2019-November/081028.html (and later in the thread)

I'd close this report as fixed...

comment:2 by rorschach, 5 years ago

Resolution: fixed
Status: newclosed

Thank you for the prompt response, Markus, and for pointing me to the PR. I was wondering how I should edit the problematic file in the beginning.

I edited the Python file (/usr/lib/grass78/gui/wxpython/gui_core/wrap.py) to match that of PR 155 and the GUI now works.

I'll go ahead and resolve this issue as fixed.

Sincerely,

Ben Hur

Note: See TracTickets for help on using tickets.