Opened 2 years ago

Closed 9 months ago

#4015 closed defect (wontfix)

ctypes: TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.8.3
Component: Python ctypes Version: git-releasebranch78
Keywords: ctypes, python3 Cc:
CPU: Unspecified Platform: Unspecified

Description

Alpine edge ships Python 3.8.1. When compiling GRASS 7.8 addons like i.cutlines (and other) addons, following error occurs:

Default locale settings are missing. GRASS running with C locale.
Starting GRASS GIS...
Creating new GRASS GIS location <tmploc>...
Cleaning up temporary files...
Executing <g.extension -s extension=i.cutlines> ...
Fetching <i.cutlines> from GRASS GIS Addons repository (be patient)...
Compiling...
Traceback (most recent call last):
  File "/usr/lib/python3.8/ctypes/__init__.py", line 99, in CFUNCTYPE
    return _c_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.c_int'>, (<class 'grass.lib.ctypes_preamble.String'>,), 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/grass7-root-73/tmpumv5zbxd/i.cutlines/scripts/i.cutlines", line 171, in <module>
    from grass.pygrass.modules.grid.grid import GridModule
  File "/usr/local/grass78/etc/python/grass/pygrass/modules/grid/__init__.py", line 2, in <module>
    from grass.pygrass.modules.grid.grid import GridModule
  File "/usr/local/grass78/etc/python/grass/pygrass/modules/grid/grid.py", line 12, in <module>
    from grass.pygrass.gis import Mapset, Location
  File "/usr/local/grass78/etc/python/grass/pygrass/gis/__init__.py", line 13, in <module>
    import grass.lib.gis as libgis
  File "/usr/local/grass78/etc/python/grass/lib/gis.py", line 451, in <module>
    ('checker', CFUNCTYPE(UNCHECKED(c_int), String)),
  File "/usr/lib/python3.8/ctypes/__init__.py", line 101, in CFUNCTYPE
    class CFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
make: *** [/usr/local/grass78/include/Make/Html.make:14: i.cutlines.tmp.html] Error 1
ERROR: Compilation failed, sorry. Please check above error messages.
Execution of <g.extension -s extension=i.cutlines> finished.
Cleaning up temporary files...

We used this docker image:

https://hub.docker.com/r/mundialis/grass-py3-pdal/tags

-> docker pull mundialis/grass-py3-pdal:stable-alpine

Change History (7)

comment:1 by Sylvain POULAIN, 2 years ago

Hi,

Don't know if it's related but seems to have same error in archlinux. Build is fine but launching g.gui wxpython gives errors : All argtypes in gis.py return error. Using python 3.8.0 launch grass wxpython succesfully

$ pacman -Q python-wxpython
python-wxpython 4.0.7-1
$ pacman -Q python
python 3.8.1-3
$ grass78 
Default locale not found, using UTF-8
Default locale settings are missing. GRASS running with C locale.
Starting GRASS GIS...
Cleaning up temporary files...

          __________  ___   __________    _______________
         / ____/ __ \/   | / ___/ ___/   / ____/  _/ ___/
        / / __/ /_/ / /| | \__ \\_  \   / / __ / / \__ \
       / /_/ / _, _/ ___ |___/ /__/ /  / /_/ // / ___/ /
       \____/_/ |_/_/  |_/____/____/   \____/___//____/

Welcome to GRASS GIS 7.8.2
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...
GRASS 7.8.2 (newLocation):~ > Traceback (most recent call last):
  File "/usr/lib/python3.8/ctypes/__init__.py", line 99, in CFUNCTYPE
    return _c_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.c_int'>, (<class 'grass.lib.ctypes_preamble.String'>,), 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/grass/gui/wxpython/wxgui.py", line 105, in OnInit
    from lmgr.frame import GMFrame
  File "/opt/grass/gui/wxpython/lmgr/frame.py", line 51, in <module>
    from lmgr.layertree import LayerTree, LMIcons
  File "/opt/grass/gui/wxpython/lmgr/layertree.py", line 38, in <module>
    from mapdisp.frame import MapFrame
  File "/opt/grass/gui/wxpython/mapdisp/frame.py", line 33, in <module>
    from mapdisp.toolbars import MapToolbar, NvizIcons
  File "/opt/grass/gui/wxpython/mapdisp/toolbars.py", line 22, in <module>
    from nviz.main import haveNviz
  File "/opt/grass/gui/wxpython/nviz/main.py", line 24, in <module>
    from nviz import mapwindow
  File "/opt/grass/gui/wxpython/nviz/mapwindow.py", line 42, in <module>
    from nviz.workspace import NvizSettings
  File "/opt/grass/gui/wxpython/nviz/workspace.py", line 23, in <module>
    from nviz import wxnviz
  File "/opt/grass/gui/wxpython/nviz/wxnviz.py", line 51, in <module>
    from grass.lib.gis import *
  File "/opt/grass/etc/python/grass/lib/gis.py", line 552, in <module>
    ('checker', CFUNCTYPE(UNCHECKED(c_int), String)),
  File "/usr/lib/python3.8/ctypes/__init__.py", line 101, in CFUNCTYPE
    class CFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
OnInit returned false, exiting...

comment:2 by Sylvain POULAIN, 2 years ago

Well, they will revert changes in 3.8.2 ... So it will work again with python 3.8.2 : https://github.com/python/cpython/pull/17960

comment:3 by carmenTawalika, 2 years ago

Recompiling Python3.8.1 with this patch from pull/17960 (https://github.com/python/cpython/commit/eb9ba2f66df2195a9c6295e73ab3d545a1445f05.patch) looks promising until now...

in reply to:  3 ; comment:4 by mmetz, 2 years ago

Replying to carmenTawalika:

Recompiling Python3.8.1 with this patch from pull/17960 (https://github.com/python/cpython/commit/eb9ba2f66df2195a9c6295e73ab3d545a1445f05.patch) looks promising until now...

Great, thanks for figuring this out!

Python 3.7.6 and Python 3.8.0 are also affected and need to be patched.

in reply to:  4 ; comment:5 by neteler, 2 years ago

Replying to mmetz:

Python 3.7.6 and Python 3.8.0 are also affected and need to be patched.

I have filed a bug report on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1794572

Of course, other distros will face the same problem.

in reply to:  5 comment:6 by neteler, 2 years ago

Replying to neteler:

Replying to mmetz:

Python 3.7.6 and Python 3.8.0 are also affected and need to be patched.

I have filed a bug report on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1794572 Of course, other distros will face the same problem.

For the record:

Hint for Fedora users: to downgrade to Python 3.7.4, just run dnf downgrade python.

comment:7 by nila, 9 months ago

Resolution: wontfix
Status: newclosed

Please reopen if needed.

Note: See TracTickets for help on using tickets.