wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.21k stars 509 forks source link

Failed to Build wxPython 4.2.1 on WOA #2521

Open ZYPThu opened 3 months ago

ZYPThu commented 3 months ago

Operating system: Windows 11 on ARM wxPython version & source: wxPython 4.2.1 downloaded by pip Python version & source: Python 3.11.6 for ARM64 stable release download from python.org

Description of the problem: I try to build wxPython 4.2.1 on Windows 11 ARM, but it failed. I already have vsbuild tools installed. The information are as following:

"D:\Anaconda3\envs\Python311-ARM64\Scripts\python.exe" -u build.py build C:\Users\galoi\AppData\Local\Temp\pip-req-build-4v921m59\build.py:43: DeprecationWarning: dep_util is Deprecated. Use functions from setuptools instead. from distutils.dep_util import newer, newer_group Will build using: "D:\Anaconda3\envs\Python311-ARM64\Scripts\python.exe" 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 15:03:40) [MSC v.1935 64 bit (ARM64)] Python's architecture is 64bit cfg.VERSION: 4.2.1

  Running command: build
  Running command: build_wx
  Traceback (most recent call last):
    File "C:\Users\galoi\AppData\Local\Temp\pip-req-build-4v921m59\build.py", line 2377, in <module>
      main(sys.argv[1:])
    File "C:\Users\galoi\AppData\Local\Temp\pip-req-build-4v921m59\build.py", line 208, in main
      function(options, args)
    File "C:\Users\galoi\AppData\Local\Temp\pip-req-build-4v921m59\build.py", line 1452, in cmd_build
      cmd_build_wx(options, args)
    File "C:\Users\galoi\AppData\Local\Temp\pip-req-build-4v921m59\build.py", line 1462, in cmd_build_wx
      checkCompiler()
    File "C:\Users\galoi\AppData\Local\Temp\pip-req-build-4v921m59\build.py", line 795, in checkCompiler
      info = getMSVCInfo(PYTHON, arch, set_env=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\galoi\AppData\Local\Temp\pip-req-build-4v921m59\buildtools\config.py", line 993, in getMSVCInfo
      from attrdict import AttrDict
    File "D:\Anaconda3\envs\Python311-ARM64\Lib\site-packages\attrdict\__init__.py", line 5, in <module>
      from attrdict.mapping import AttrMap
    File "D:\Anaconda3\envs\Python311-ARM64\Lib\site-packages\attrdict\mapping.py", line 4, in <module>
      **from collections import Mapping
  ImportError: cannot import name 'Mapping' from 'collections' (D:\Program Files\Python311-arm64\Lib\collections\__init__.py)**
  Finished command: build_wx (0.11s)
  Finished command: build (0.12s)
  Command '"D:\Anaconda3\envs\Python311-ARM64\Scripts\python.exe" -u build.py build' failed with exit code 1.
  [end of output]
Code Example (click to expand) ```python # Put code sample here ```
DietmarSchwertberger commented 3 months ago

You probably have the wrong 'attrdict'. Try attrdict3 instead.

See https://github.com/wxWidgets/Phoenix/blob/master/requirements/devel.txt

The build process also requires a bash. On my Windows I have a bash.exe on the path which will just print a message about WSL. Unfortunately wxPython tries to take this one instead of the one from cygwin.

DietmarSchwertberger commented 3 months ago

On more trap to avoid: When you install sip, you also get some binaries. E.g. "...path..to..python\Scripts\sip-build.exe". The Scripts dir needs to be on your path.

ZYPThu commented 3 months ago

You probably have the wrong 'attrdict'. Try attrdict3 instead.

See https://github.com/wxWidgets/Phoenix/blob/master/requirements/devel.txt

The build process also requires a bash. On my Windows I have a bash.exe on the path which will just print a message about WSL. Unfortunately wxPython tries to take this one instead of the one from cygwin.

Thanks! That's really helpful.

ZYPThu commented 3 months ago

Sadly I still cannot build this package on my own. The new problem seems caused by Setuptools probably. From the error code it seems that the setuptools does not work well for Python 3.11 ARM64. Here are the error codes.

Traceback (most recent call last): File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\bin\waf3-2.0.24-c88b74123ce8b9d1a27999f7cf96dff0\waflib\Scripting.py", line 119, in waf_entry_point run_commands() File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\bin\waf3-2.0.24-c88b74123ce8b9d1a27999f7cf96dff0\waflib\Scripting.py", line 182, in run_commands ctx=run_command(cmd_name) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\bin\waf3-2.0.24-c88b74123ce8b9d1a27999f7cf96dff0\waflib\Scripting.py", line 173, in run_command ctx.execute() File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\bin\waf3-2.0.24-c88b74123ce8b9d1a27999f7cf96dff0\waflib\Configure.py", line 85, in execute super(ConfigurationContext,self).execute() File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\bin\waf3-2.0.24-c88b74123ce8b9d1a27999f7cf96dff0\waflib\Context.py", line 92, in execute self.recurse([os.path.dirname(g_module.root_path)]) File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\bin\waf3-2.0.24-c88b74123ce8b9d1a27999f7cf96dff0\waflib\Context.py", line 133, in recurse user_function(self) File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\wscript", line 98, in configure conf.my_check_python_headers() File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\bin\waf3-2.0.24-c88b74123ce8b9d1a27999f7cf96dff0\waflib\Configure.py", line 175, in fun return f(*k,**kw) ^^^^^^^^^^ File "C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\wscript", line 474, in my_check_python_headers dist_compiler.initialize() File "D:\Anaconda3\envs\Python311-ARM64\Lib\site-packages\setuptools_distutils\msvc9compiler.py", line 373, in initialize raise DistutilsPlatformError( distutils.errors.DistutilsPlatformError: --plat-name must be one of ('win32', 'win-amd64') Command '"D:\Anaconda3\envs\Python311-ARM64\Scripts\python.exe" C:\Users\galoi\AppData\Local\Temp\pip-install-ac1iatlb\wxpython_4c1d4c335ec6495f8b8a94e42aa30259\bin\waf-2.0.24 --msvc_arch=x64 --python="D:\Anaconda3\envs\Python311-ARM64\Scripts\python.exe" --out=build/waf/3.11/x64/release configure build ' failed with exit code 2. Finished command: build_py (0m5.292s) Finished command: build (11m32.288s) Command '"D:\Anaconda3\envs\Python311-ARM64\Scripts\python.exe" -u build.py build' failed with exit code 2. [end of output]

swt2c commented 3 months ago

Unfortunately, it looks like the Phoenix build process assumes 64-bit is x64, see here: https://github.com/wxWidgets/Phoenix/blob/master/build.py#L1718

You could try tweaking those arguments. Unfortunately, arm64 w/ Windows is a rare thing, so not sure I'd have access to a machine to troubleshoot.