Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

WXPYTHON 4.2.0 REFUSED TO BUILD ON PYTHON 3.9 AND 3.10

Open baaziznasser opened this issue 3 years ago • 4 comments

hello, i was using wxpython 4.1.1 on python 3.9,, i updated python to 3.10 and i wanted to update the wxpython also, i tried to install it using pip install wxpython but always i get a building problem, i tried to install vs 2022,community and all the required packages are installed here is the error

    File "C:\Users\nacer baaziz\AppData\Local\Temp\pip-install-7_5b8oll\wxpython_735dbcfdfa8e47b48b91adcf9cb4970f\bu

ildtools\build_wxwidgets.py", line 503, in main
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
File "C:\Users\nacer baaziz\AppData\Local\Temp\pip-install-7_5b8oll\wxpython_735dbcfdfa8e47b48b91adcf9cb4970f\bu ildtools\build_wxwidgets.py", line 72, in exitIfError
raise builder.BuildError(msg)
buildtools.builder.BuildError: Error building
Finished command: build_wx (0m23.666s)
Finished command: build (0m23.666s)
WARNING: Building this way assumes that all generated files have been
generated already. If that is not the case then use build.py directly
to generate the source and perform the build stage. You can use
--skip-build with the bdist_* or install commands to avoid this
message and the wxWidgets and Phoenix build steps in the future.

  "C:\Users\nacer baaziz\AppData\Local\Programs\Python\Python310-32\python.exe" -u build.py build                   
  Command '"C:\Users\nacer baaziz\AppData\Local\Programs\Python\Python310-32\python.exe" -u build.py build' failed w

ith exit code 1.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> wxpython

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

where is the problem please? and how i can fix it?<!-- For bugs or other problems please provide the following details in addition to your issue report, if applicable. See also https://wxpython.org/pages/how-to-submit-issue/

 For issues about building on Linux, please read this page before reporting it here:
 https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/

-->

Operating system: wxPython version & source: Python version & source:

Description of the problem:

Code Example (click to expand)
# Put code sample here

baaziznasser avatar Aug 14 '22 17:08 baaziznasser

am using windows10 21h2 x64 python 3.9 and 3.10 32bit also i tried it on windows 11 and python 3.10

baaziznasser avatar Aug 14 '22 17:08 baaziznasser

It looks like @RobinD42 only build 64-bit wheels for Windows. Robin, any reason you didn't build 32-bit wheels?

@baaziznasser can you use 64-bit Python?

swt2c avatar Aug 16 '22 02:08 swt2c

@swt2c i need a python 32 bit, because am making a software and need to compile it to an exe that work with all windows versions

baaziznasser avatar Aug 16 '22 13:08 baaziznasser

@@RobinD42 there isn't a way to make it like the old one??? i mean 4.1.1 it was accept the installation without problem. update that please

baaziznasser avatar Aug 16 '22 13:08 baaziznasser

@RobinD42 The lack of a 32-bit wheel is blocking the NVDA screen reader from updating to a recent, supported version of Python (we're stuck on 3.7).

codeofdusk avatar Oct 11 '22 00:10 codeofdusk

I don't think that's true @codeofdusk, it would just be good to have a 32bit wheel so we can easily update to wxPython 4.2.0

seanbudd avatar Oct 11 '22 00:10 seanbudd

Sorry, this is also blocking us from updating to Python 3.10, locking us at python 3.9 too

seanbudd avatar Oct 11 '22 01:10 seanbudd

Hi,

Is it because of distutils/setuptools/msi issue? I remember seeing something in a Git log for wxPython a while back. We (NVDA developers) would like to move to Python 3.10/3.11 as it includes updated libffi library that fixes a critical showstopper, and Python 3.7 will be end of life in 2023.

Thanks.

josephsl avatar Oct 11 '22 02:10 josephsl

Hi,

Managed to build a wheel for 32-bit Python 3.7 (tweaked instructions from https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html):

Environment: Windows 11 2022 Update (Version 22H2 build 22623.741 beta), Python 3.7.9 32-bit, Visual Studio 2022 Community

  1. Install Visual Studio 2022 Community. For Python 3.7 support, try installing VS141/VS142 tools (I have VS142 tools installed for developing NVDA screen reader). You can skip this if you have VS2022 installed.
  2. From Command Prompt/PowerShell/Windows Terminal, run the following (press Enter after each command):

py -3.7 -m pip install --upgrade pip (you can skip this if pip is up to date) py -3.7 -m pip install wheel (you need this to generate wheels) py -3.7 -m pip install attrdict (without this dependency, wxPython's setup.py will fail) py -3.7 -m pip download wxpython==4.2.0 (you don't have to specify version tag as 4.2.0 is the latest as of time of this comment) py -3.7 -m pip wheel -v wxPython-4.2.0.tar.gz

In the last command, you can specify where to dump the wheel file (with Command Prompt running without admin privileges, default folder is %sysdrive%\Users{username}.

Compilation process:

  1. Visual Studio compiler (cl.exe) is run to compile C++ files.
  2. SIP is run to generate Python wrapper for C++ files.
  3. Data such as localization are processed.

The entire process takes at least fifteen minutes (I have an SSD with Intel 11th gen Core I7 processor inside a Lenovo ThinkPad laptop).

Thanks.

josephsl avatar Oct 11 '22 04:10 josephsl

Hi,

Turns out this issue may not be related to wxPython - it is attrdict that is the likely culprit, as it wants to import collections.Mapping which is gone in Python 3.9. My question then is why use attrdict which hasn't been updated since February 2019 - perhaps there might be an updated version that might not have been registered with Python Package Index.

Thanks.

josephsl avatar Oct 11 '22 05:10 josephsl

Hi,

Update: managed to build Python 3.11 32-bit wxPython wheel. Some extra steps must be performed in addition to the ones listed for Python 3.7:

  1. Install requests package from PYPI BEFORE downloading wxpython.
  2. After installing attrdict, open the attrdict directory (Python instal folder/lib/site-packages/attrdict), open Python files in there, then change "from collections import Mapping" to "from collections.abc import Mapping".

If people say yes and provided that I manage to build 32-bit wheels for Python 3.8, 3.9, and 3.10, I'm willing to host 32-bit wheels on a GitHub repository for the time being (for Python 3.7, I don't expect to build further 32-bit wheels as that Python release is in security releases only mode). I will remove 32-bit wheels if Robin asks.

Thanks.

josephsl avatar Oct 11 '22 06:10 josephsl

Hi, Wheels:

  • Python 3.7: https://github.com/josephsl/wxpy32whl/releases/download/4.2.0/wxPython-4.2.0-cp37-cp37m-win32.whl
  • Python 3.8: https://github.com/josephsl/wxpy32whl/releases/download/4.2.0/wxPython-4.2.0-cp38-cp38-win32.whl
  • Python 3.9: https://github.com/josephsl/wxpy32whl/releases/download/4.2.0/wxPython-4.2.0-cp39-cp39-win32.whl
  • Python 3.10: https://github.com/josephsl/wxpy32whl/releases/download/4.2.0/wxPython-4.2.0-cp310-cp310-win32.whl
  • Python 3.11: https://github.com/josephsl/wxpy32whl/releases/download/4.2.0/wxPython-4.2.0-cp311-cp311-win32.whl

Even with these wheels, I think it would be best to leave this issue open until Robin addresses it - for projects requiring 32-bit wxPython wheels, give it a try.

Thanks.

josephsl avatar Oct 11 '22 07:10 josephsl

Other option is use the workflows with Azure Pipelines and generate the artifacts

oleksis avatar Oct 11 '22 11:10 oleksis

Hi, true. Robin, can we close this in favor of Azure pipelines issue as it is much easier? Thanks.

josephsl avatar Oct 11 '22 14:10 josephsl