#69058 closed defect (fixed)

py311-wxpython-4.0 @4.2.1: 'cython.object' is not a valid cython.* module

Reported by: myart4ios Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: py311-wxpython-4.0

Description

This is on MacBook Pro with M1 Pro processor running Sonoma 14.2.1.

Installing dependencies proceeds then breaks.

py311-wxwidgets-4.0 main log is attached.

Did clean(s) and retried. Also didn't find any relevant existing tickets.

$ sudo port install kicad
--->  Computing dependencies for kicad
The following dependencies will be installed: 
 gsed
 py311-wxpython-4.0
 swig
 swig-python
 unixODBC
Continue? [Y/n]: 
--->  Fetching archive for py311-wxpython-4.0
--->  Attempting to fetch py311-wxpython-4.0-4.2.1_0.darwin_23.arm64.tbz2 from https://packages.macports.org/py311-wxpython-4.0
--->  Attempting to fetch py311-wxpython-4.0-4.2.1_0.darwin_23.arm64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/py311-wxpython-4.0
--->  Attempting to fetch py311-wxpython-4.0-4.2.1_0.darwin_23.arm64.tbz2 from http://mirror.fcix.net/macports/packages/py311-wxpython-4.0
--->  Building py311-wxpython-4.0
Error: Failed to build py311-wxpython-4.0: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_python_py-wxpython-4.0/py311-wxpython-4.0/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port kicad failed

Attachments (1)

main.log.gz (72.8 KB) - added by myart4ios 10 months ago.

Download all attachments as: .zip

Change History (7)

Changed 10 months ago by myart4ios

Attachment: main.log.gz added

comment:1 Changed 10 months ago by JohnPritchard (Johnny P)

This is because of the recent upgrade of cython from 0.29.36 to 3.0.7 (and then 3.0.8), see https://github.com/wxWidgets/Phoenix/issues/2514.

The solution is to apply the patch pointed to in that GitHub wxpython issue ticket, e.g. do:

cd /tmp/
git clone https://github.com/wxWidgets/Phoenix.git
cd Phoenix
git diff dac1e86 aeb557d | sed -e 's@ ./wx/@ wx/@g' > 0001-Fix-compatibility-with-Cython-3.0.0.diff

The patch file 0001-Fix-compatibility-with-Cython-3.0.0.diff can then be applied (with -p0) to the wxpython-4.0 source, i.e. it can be added as a patch to the file directory for the wxpython-4.0 Port and in the Portfile and should result in a successful build.

To test/build in the meantime do:

pyVer=311 ## replace with desired python version...
cd /tmp/
git clone https://github.com/wxWidgets/Phoenix.git
cd Phoenix
git diff dac1e86 aeb557d | sed -e 's@ ./wx/@ wx/@g' > 0001-Fix-compatibility-with-Cython-3.0.0.diff
sudo port clean py${pyVer}-wxpython-4.0
sudo port patch py${pyVer}-wxpython-4.0
cd /opt/local/var/macports/build/
cd _opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_python_py-wxpython-4.0
cd py${pyVer}-wxpython-4.0/work/wxPython-4.2.1/
sudo -u macports patch -p0 < /tmp/Phoenix/0001-Fix-compatibility-with-Cython-3.0.0.diff
sudo port install py${pyVer}-wxpython-4.0
Last edited 10 months ago by JohnPritchard (Johnny P) (previous) (diff)

comment:2 Changed 10 months ago by JohnPritchard (Johnny P)

Oh, forgot to say, hopefully someone can update the wxpython Portfile and make a new release. Note, we need this patch because 4.2.1 is still the latest release of wxpython-4.0.

comment:3 Changed 10 months ago by myart4ios

Thanks for the response. Your workaround worked for me (sed complained about the -I option but I see that has been removed now).

comment:4 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)

Port: kicad removed
Summary: kicad 7.0.9 fails install due to py311-wxpython-4.0 build failurepy311-wxpython-4.0 @4.2.1: 'cython.object' is not a valid cython.* module

The error in the log was:

[1/1] Cythonizing wx/svg/_nanosvg.pyx
Error compiling Cython file:
------------------------------------------------------------
...
for manipulating the SVG shape info in memory.
"""
import sys
cimport cython.object
        ^
------------------------------------------------------------
wx/svg/_nanosvg.pyx:45:8: 'cython.object' is not a valid cython.* module
Traceback (most recent call last):
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_python_py-wxpython-4.0/py311-wxpython-4.0/work/wxPython-4.2.1/setup-wxsvg.py", line 54, in <module>
    modules = cythonize([module],
              ^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
    cythonize_one(*args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: wx/svg/_nanosvg.pyx

comment:5 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Status: newaccepted

comment:6 Changed 10 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In fef4f9c647fad253dc30f2a9bf2ad2da7aaf5b74/macports-ports (master):

py-wxpython-4.0: Fix build with cython 3

Closes: #69058
See: wxWidgets/Phoenixhttps://github.com/macports/macports-ports/pull/2514

Note: See TracTickets for help on using tickets.