Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pip install of wxPython 4.2.0 fails with python 3.11 #2296

Closed
zanseb opened this issue Oct 25, 2022 · 79 comments
Closed

Pip install of wxPython 4.2.0 fails with python 3.11 #2296

zanseb opened this issue Oct 25, 2022 · 79 comments

Comments

@zanseb
Copy link

zanseb commented Oct 25, 2022

Operating system: Windows 11 21h2
wxPython version & source: 4.2.0, pip
Python version & source: 3.11, stock

Description of the problem: It is possible to download wxPython 4.2.0 with python 3.11, but the installation fails with the following error.

Collecting attrdict3==2.0.2
  Downloading attrdict3-2.0.2-py2.py3-none-any.whl (10 kB)
Collecting wxPython==4.2.0
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\sebastian.zanoni\AppData\Local\Temp\pip-install-r3muw0vn\wxpython_5c9d35d3ceba4024bd3688fcf9f73870\setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "C:\Users\sebastian.zanoni\AppData\Local\Temp\pip-install-r3muw0vn\wxpython_5c9d35d3ceba4024bd3688fcf9f73870\buildtools\config.py", line 30, in <module>
          from attrdict import AttrDict
      ModuleNotFoundError: No module named 'attrdict'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

I tried with both package attrdict and attrdict3
Everything works as expected with py310, even w/o the attrdict package.

@zanseb zanseb changed the title Pip install of wxPython 4.2.0 fails Pip install of wxPython 4.2.0 fails with python 3.11 Oct 25, 2022
@swt2c
Copy link
Collaborator

swt2c commented Oct 25, 2022

Did you install attrdict3 before trying to install wxPython? Unfortunately, that needs to happen.

@zanseb
Copy link
Author

zanseb commented Oct 25, 2022

I installed attrdict3 via pip right before installing wxPython. You can see it in the output above. Is there maybe a specific way to install it or is pip install sufficient?

@swt2c
Copy link
Collaborator

swt2c commented Oct 25, 2022

Looking at the log above, it looks like you installed it as part of the same transaction...

@zanseb
Copy link
Author

zanseb commented Oct 25, 2022

Correct, it is part of the requirements.txt which is installed all at once with pip. Do you think I need to install it seperately?

@swt2c
Copy link
Collaborator

swt2c commented Oct 25, 2022

Correct, it is part of the requirements.txt which is installed all at once with pip. Do you think I need to install it seperately?

Yes.

@zanseb
Copy link
Author

zanseb commented Oct 25, 2022

Thanks, I tried it and it got a step further. Unfortunately i get following error while compiling the package

  × Running setup.py install for wxPython did not run successfully.
  │ exit code: 1
  ╰─> [63 lines of output]
      C:\Users\sebastian.zanoni\.virtualenvs\311\Lib\site-packages\setuptools\dist.py:771: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
        warnings.warn(
      C:\Users\sebastian.zanoni\.virtualenvs\311\Lib\site-packages\setuptools\config\setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      C:\Users\sebastian.zanoni\.virtualenvs\311\Lib\site-packages\setuptools\dist.py:317: DistDeprecationWarning: use_2to3 is ignored.
        warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
      running install
      C:\Users\sebastian.zanoni\.virtualenvs\311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      Will build using: "C:\Users\sebastian.zanoni\.virtualenvs\311\Scripts\python.exe"
      3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
      Python's architecture is 64bit
      cfg.VERSION: 4.2.0

      Running command: build
      Running command: build_wx
      CL.exe: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\cl.exe
      Downloading microsoft.web.webview2 1.0.1185.39...
      Connection successful...
      Data downloaded...
      wxWidgets build options: ['--wxpython', '--unicode']
      Updating wx/msw/setup.h
      setting build options...
      nmake.exe -f makefile.vc UNICODE=1 OFFICIAL_BUILD=1 COMPILER_VERSION=140 SHARED=1 MONOLITHIC=0 USE_OPENGL=1 USE_GDIPLUS=1 BUILD=release

      Microsoft (R) Program Maintenance Utility Version 14.33.31629.0
      Copyright (C) Microsoft Corporation.  All rights reserved.

          if not exist vc140_x64_mswudll mkdir vc140_x64_mswudll
          if not exist ..\..\lib\vc140_x64_dll mkdir ..\..\lib\vc140_x64_dll
          if not exist ..\..\lib\vc140_x64_dll\mswu mkdir ..\..\lib\vc140_x64_dll\mswu
          if not exist ..\..\lib\vc140_x64_dll\mswu\wx mkdir ..\..\lib\vc140_x64_dll\mswu\wx
          if not exist ..\..\lib\vc140_x64_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\vc140_x64_dll\mswu\wx\setup.h
              1 file(s) copied.
          if not exist ..\..\lib\vc140_x64_dll\mswu\wx\msw mkdir ..\..\lib\vc140_x64_dll\mswu\wx\msw
          cl /EP /nologo  "..\..\include\wx\msw\genrcdefs.h" > "..\..\lib\vc140_x64_dll\mswu\wx\msw\rcdefs.h"
      genrcdefs.h
          cl /c /nologo /TC /Fovc140_x64_mswudll\wxregex_pcre2_auto_possess.obj /MD /DWIN32  /Zi /Fd..\..\lib\vc140_x64_dll\wxregexu.pdb   /O2 /D_CRT_SECURE_NO_DEPRECATE=1  /D_CRT_NON_CONFORMING_SWPRINTFS=1 /D_SCL_SECURE_NO_WARNINGS=1  /D__NO_VC_CRTDBG__  /DNDEBUG  /D_CRT_SECURE_NO_WARNINGS /I..\..\include /I..\..\lib\vc140_x64_dll\mswu  /I..\..\3rdparty\pcre\src\wx /D__WX__ /DHAVE_CONFIG_H /D_UNICODE    ..\..\3rdparty\pcre\src\pcre2_auto_possess.c
      pcre2_auto_possess.c
      C:\Users\sebastian.zanoni\AppData\Local\Temp\pip-install-cegcsy52\wxpython_8e836178d56747d496ae073d0bfca6de\ext\wxWidgets\include\wx/chartype.h(105): fatal error C1083: Cannot open include file: 'tchar.h': No such file or directory
      NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\cl.EXE"' : return code '0x2'
      Stop.
      Error building
      ERROR: failed building wxWidgets
      Traceback (most recent call last):
        File "C:\Users\sebastian.zanoni\AppData\Local\Temp\pip-install-cegcsy52\wxpython_8e836178d56747d496ae073d0bfca6de\build.py", line 1563, in cmd_build_wx
          wxbuild.main(wxDir(), build_options)
        File "C:\Users\sebastian.zanoni\AppData\Local\Temp\pip-install-cegcsy52\wxpython_8e836178d56747d496ae073d0bfca6de\buildtools\build_wxwidgets.py", line 503, in main
          exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
        File "C:\Users\sebastian.zanoni\AppData\Local\Temp\pip-install-cegcsy52\wxpython_8e836178d56747d496ae073d0bfca6de\buildtools\build_wxwidgets.py", line 72, in exitIfError
          raise builder.BuildError(msg)
      buildtools.builder.BuildError: Error building
      Finished command: build_wx (0m1.984s)
      Finished command: build (0m1.984s)
      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\sebastian.zanoni\.virtualenvs\311\Scripts\python.exe" -u build.py build
      Command '"C:\Users\sebastian.zanoni\.virtualenvs\311\Scripts\python.exe" -u build.py build' failed with 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

Somehow it doen't find tchar.h -> Cannot open include file: 'tchar.h': No such file or directory

@swt2c
Copy link
Collaborator

swt2c commented Oct 25, 2022

Not sure about that. Do you have C++ support installed with Visual Studio?

@zanseb
Copy link
Author

zanseb commented Oct 25, 2022

Yes, wxpython with python 3.10 works fine on the same machine.
Could the reason be that there is a wheel file of this package for python310 but not for python311? Meaning that I do not actually compile wxPython for py310?

@swt2c
Copy link
Collaborator

swt2c commented Oct 25, 2022

Yes, wxpython with python 3.10 works fine on the same machine. Could the reason be that there is a wheel file of this package for python310 but not for python311? Meaning that I do not actually compile wxPython for py310?

Indeed. If you installed the wheel for Python 3.10, then you did not compile it yourself.

@pratik139patel
Copy link

So how can we resolve this issue? Can you guide me how to compile wxPython for 3.11?

@zanseb
Copy link
Author

zanseb commented Oct 25, 2022

FWIW, I have done a little more research and the main reason the build is failing (at least for my setup) is that the include paths are not resolved correctly. tchar.h can be found on my system at C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt, however when executing following build step

Phoenix/buildtools/config.py

Lines 997 to 1006 in 3ee614e

cmd = \
"import os, sys, setuptools.msvc; " \
"setuptools.msvc.isfile = lambda path: path is not None and os.path.isfile(path); " \
"ei = setuptools.msvc.EnvironmentInfo('{}', vc_min_ver=14.0); " \
"env = ei.return_env(); " \
"env['vc_ver'] = ei.vc_ver; " \
"env['vs_ver'] = ei.vs_ver; " \
"env['arch'] = ei.pi.arch; " \
"env['py_ver'] = sys.version_info[:2]; " \
"print(env)"
the above mentioned path is not found.

I don't know whether the build is supposed to work with win11 and VS2022, therefore I guess I'll wait for the offical wheels, thanks for your help!

Let me know if you want to do further investigation, I'll be happy to help. Thanks again.

@vlandau
Copy link

vlandau commented Oct 26, 2022

This same thing is happening to me in Python 3.10 in docker. To reproduce:

Enter the Ubunutu-based Python 3.10 docker container

docker run -it python3.10 bash

Then run pip install wxPython==4.2.0 in the container to get the error:

⟩ docker run -it python:3.10 bash
root@bb96d10e2c88:/# pip install wxPython==4.2.0
Collecting wxPython==4.2.0
  Downloading wxPython-4.2.0.tar.gz (71.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 71.0/71.0 MB 9.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-x50rr2yc/wxpython_8d81c8b381de4bab88b403313cd92605/setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "/tmp/pip-install-x50rr2yc/wxpython_8d81c8b381de4bab88b403313cd92605/buildtools/config.py", line 30, in <module>
          from attrdict import AttrDict
      ModuleNotFoundError: No module named 'attrdict'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

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

[notice] A new release of pip available: 22.2.2 -> 22.3
[notice] To update, run: pip install --upgrade pip

It seems that attrdict3 needs to be installed for wxPython to successfully installed regardless of OS, but attrdict3 is only required when the host OS is windows: https://github.com/wxWidgets/Phoenix/blob/master/requirements/devel.txt#L24

@swt2c
Copy link
Collaborator

swt2c commented Oct 26, 2022

Yes @vlandau I addressed that here: 2e9169e

@vlandau
Copy link

vlandau commented Oct 26, 2022

@swt2c, thanks for the quick response! Is that change not reflected in 4.2.0? I appears that attrdict3 wasn't made a requirement for the package in the latest version. I very well could be missing something, though.

@swt2c
Copy link
Collaborator

swt2c commented Oct 26, 2022

@swt2c, thanks for the quick response! Is that change not reflected in 4.2.0? I appears that attrdict3 wasn't made a requirement for the package in the latest version. I very well could be missing something, though.

No, that change was made post-4.2.0.

@vlandau
Copy link

vlandau commented Oct 26, 2022

Okay sounds good! I assume it'll be in the next patch release? Thanks again!

@RobinD42
Copy link
Member

This issue has been mentioned on Discuss wxPython. There might be relevant details there:

https://discuss.wxpython.org/t/wxpython-install-issue-on-macos-11-6-with-pyenv-and-python-3-11-0/36203/1

@RobinD42
Copy link
Member

RobinD42 commented Nov 1, 2022

This issue has been mentioned on Discuss wxPython. There might be relevant details there:

https://discuss.wxpython.org/t/is-wxpython-compatible-with-python-3-11-0-on-windows-10/36211/2

@zanseb
Copy link
Author

zanseb commented Nov 1, 2022

@RobinD42, are you planning to build and publish the wheels for python 3.11?

@swt2c
Copy link
Collaborator

swt2c commented Nov 8, 2022

There will have to be a new release for supporting python 3.11.

@C-BERBER
Copy link

I too am having this problem after upgrading the os.. and I installed the packages separately before running the build. Any advice here would be appreciated since I can't run any of my wx code

(base) chrisb@GX701GXR:$ pip3 install attrdict
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: attrdict in /usr/local/lib/python3.10/dist-packages (2.0.1)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from attrdict) (1.16.0)
(base) chrisb@GX701GXR:
$ sudo pip3 install wxpython
[sudo] password for chrisb:
Collecting wxpython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/tmp/pip-install-6cudl9pt/wxpython_7b0d83780ca349b0bdca9095067195dd/setup.py", line 27, in
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
File "/tmp/pip-install-6cudl9pt/wxpython_7b0d83780ca349b0bdca9095067195dd/buildtools/config.py", line 30, in
from attrdict import AttrDict
File "/usr/local/lib/python3.10/dist-packages/attrdict/init.py", line 5, in
from attrdict.mapping import AttrMap
File "/usr/local/lib/python3.10/dist-packages/attrdict/mapping.py", line 4, in
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

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

@swt2c
Copy link
Collaborator

swt2c commented Nov 11, 2022 via email

@TheQuinbox
Copy link

I'm having this too. I did:

pip install attrdict3
pip install wxpython

And got:
Collecting wxpython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: wxpython
Building wheel for wxpython (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [42 lines of output]
running bdist_wheel
running build
Will build using: "C:\Users\Owner\code\python\mastoquin\env\Scripts\python.exe"
3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
Python's architecture is 64bit
cfg.VERSION: 4.2.0

  Running command: build
  Running command: build_wx
  CL.exe: NOT FOUND
  Downloading microsoft.web.webview2 1.0.1185.39...
  Connection successful...
  Data downloaded...
  wxWidgets build options: ['--wxpython', '--unicode']
  Updating wx/msw/setup.h
  setting build options...
  Error building
  ERROR: failed building wxWidgets
  Traceback (most recent call last):
    File "C:\Users\Owner\AppData\Local\Temp\pip-install-xigqu8_5\wxpython_8546a1d74e59430585cf41deaa2aeff1\build.py", line 1563, in cmd_build_wx
      wxbuild.main(wxDir(), build_options)
    File "C:\Users\Owner\AppData\Local\Temp\pip-install-xigqu8_5\wxpython_8546a1d74e59430585cf41deaa2aeff1\buildtools\build_wxwidgets.py", line 503, in main
      exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
    File "C:\Users\Owner\AppData\Local\Temp\pip-install-xigqu8_5\wxpython_8546a1d74e59430585cf41deaa2aeff1\buildtools\build_wxwidgets.py", line 72, in exitIfError
      raise builder.BuildError(msg)
  buildtools.builder.BuildError: Error building
  Finished command: build_wx (0m4.67s)
  Finished command: build (0m4.67s)
  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\Owner\code\python\mastoquin\env\Scripts\python.exe" -u build.py build
  Command '"C:\Users\Owner\code\python\mastoquin\env\Scripts\python.exe" -u build.py build' failed with exit code 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for wxpython
Setup.py fails in a similar way.
no idea why its saying cl.exe isn't found, as I have MSVC installed (I just installed and built Rust like 2 days ago). Any ideas?

@GabrieleBattaglia
Copy link

I ve the same.
Both under Win11, Python 3.11 and Ubuntu via WSL2, python 3.8.10
None of two got success.

@zanseb
Copy link
Author

zanseb commented Nov 24, 2022

@swt2c, I have seen that you are already building the wheel for py311 (https://alldunn.visualstudio.com/wxPython-CI/_build/results?buildId=1061&view=logs&j=1673e16c-f486-5fbe-9e06-af58c9e250b7). Do you have the possibility to upload it to the snapshot builds?

@foozzi
Copy link

foozzi commented Nov 27, 2022

same issue
Fedora 36
Python 3.10.8

[fz0x1@fedora ~]$ pip3 install -v --user wxPython
Using pip 22.3.1 from /home/fz0x1/.local/lib/python3.10/site-packages/pip (python 3.10)
Collecting wxPython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Running command python setup.py egg_info
  /usr/lib/python3.10/site-packages/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
    warnings.warn(
  /usr/lib/python3.10/site-packages/setuptools/dist.py:300: DistDeprecationWarning: use_2to3 is ignored.
    warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
  running egg_info
  creating /tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info
  writing /tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info/dependency_links.txt
  writing entry points to /tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info/entry_points.txt
  writing requirements to /tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info/requires.txt
  writing top-level names to /tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info/top_level.txt
  writing manifest file '/tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  no previously-included directories found matching 'docs/sphinx/build'
  warning: no previously-included files matching '.git' found under directory 'wx'
  warning: no previously-included files matching '*.pyc' found under directory 'wx'
  warning: no previously-included files matching '__pycache__' found under directory 'wx'
  adding license file 'LICENSE.txt'
  writing manifest file '/tmp/pip-pip-egg-info-8cqo__44/wxPython.egg-info/SOURCES.txt'
  Preparing metadata (setup.py) ... done
Collecting pillow
  Downloading Pillow-9.3.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 7.1 MB/s eta 0:00:00
Requirement already satisfied: six in /usr/lib/python3.10/site-packages (from wxPython) (1.16.0)
Collecting numpy
  Downloading numpy-1.23.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.1/17.1 MB 19.7 MB/s eta 0:00:00
Installing collected packages: pillow, numpy, wxPython
  changing mode of /home/fz0x1/.local/bin/f2py to 755
  changing mode of /home/fz0x1/.local/bin/f2py3 to 755
  changing mode of /home/fz0x1/.local/bin/f2py3.10 to 755
  DEPRECATION: wxPython is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running command Running setup.py install for wxPython
  /usr/lib/python3.10/site-packages/setuptools/dist.py:723: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
    warnings.warn(
  /usr/lib/python3.10/site-packages/setuptools/dist.py:300: DistDeprecationWarning: use_2to3 is ignored.
    warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
  running install
  /usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  running build
  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.

  "/usr/bin/python3" -u build.py build
  /tmp/pip-install-lp5fz685/wxpython_5c8be3ae91b14de992d164b46d2c1031/build.py:43: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
    from distutils.dep_util import newer, newer_group
  Will build using: "/usr/bin/python3"
  3.10.8 (main, Nov 14 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-2)]
  Python's architecture is 64bit
  cfg.VERSION: 4.2.0

  Running command: build
  Running command: build_wx
  wxWidgets build options: ['--wxpython', '--unicode', '--gtk3']
  Configure options: ['--enable-unicode', '--with-gtk=3', '--enable-sound', '--enable-graphics_ctx', '--enable-display', '--enable-geometry', '--enable-debug_flag', '--enable-optimise', '--disable-debugreport', '--enable-uiactionsim', '--enable-autoidman', '--with-sdl']
  /tmp/pip-install-lp5fz685/wxpython_5c8be3ae91b14de992d164b46d2c1031/ext/wxWidgets/configure --enable-unicode --with-gtk=3 --enable-sound --enable-graphics_ctx --enable-display --enable-geometry --enable-debug_flag --enable-optimise --disable-debugreport --enable-uiactionsim --enable-autoidman --with-sdl
  checking build system type... x86_64-pc-linux-gnu
  checking host system type... x86_64-pc-linux-gnu
  checking for toolkit... gtk
  checking for gcc... gcc
  checking whether the C compiler works... yes
  checking for C compiler default output file name... a.out
  checking for suffix of executables...
  checking whether we are cross compiling... no
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether gcc accepts -g... yes
  checking for gcc option to accept ISO C89... none needed
  checking whether we are using the Intel C compiler... no
  checking how to run the C preprocessor... gcc -E
  checking for grep that handles long lines and -e... /usr/bin/grep
  checking for egrep... /usr/bin/grep -E
  checking whether gcc needs -traditional... no
  checking for g++... no
  checking for c++... no
  checking for gpp... no
  checking for aCC... no
  checking for CC... no
  checking for cxx... no
  checking for cc++... no
  checking for cl.exe... no
  checking for FCC... no
  checking for KCC... no
  checking for RCC... no
  checking for xlC_r... no
  checking for xlC... no
  checking whether we are using the GNU C++ compiler... no
  checking whether g++ accepts -g... no
  checking whether we are using the Intel C++ compiler... no
  checking whether we are using the Sun C++ compiler... no
  configure: error: C++ compiler is needed to build wxWidgets
  Error running configure
  ERROR: failed building wxWidgets
  Traceback (most recent call last):
    File "/tmp/pip-install-lp5fz685/wxpython_5c8be3ae91b14de992d164b46d2c1031/build.py", line 1563, in cmd_build_wx
      wxbuild.main(wxDir(), build_options)
    File "/tmp/pip-install-lp5fz685/wxpython_5c8be3ae91b14de992d164b46d2c1031/buildtools/build_wxwidgets.py", line 379, in main
      exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts),
    File "/tmp/pip-install-lp5fz685/wxpython_5c8be3ae91b14de992d164b46d2c1031/buildtools/build_wxwidgets.py", line 72, in exitIfError
      raise builder.BuildError(msg)
  buildtools.builder.BuildError: Error running configure
  Finished command: build_wx (0.633s)
  Finished command: build (0.633s)
  Command '"/usr/bin/python3" -u build.py build' failed with exit code 1.
  error: subprocess-exited-with-error
  
  × Running setup.py install for wxPython did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/python3 -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/tmp/pip-install-lp5fz685/wxpython_5c8be3ae91b14de992d164b46d2c1031/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' install --record /tmp/pip-record-u35w_w1i/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/fz0x1/.local/include/python3.10/wxPython
  cwd: /tmp/pip-install-lp5fz685/wxpython_5c8be3ae91b14de992d164b46d2c1031/
  Running setup.py install for wxPython ... error
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.

@JacekRuzyczka
Copy link

I've got the same trouble on a SuSE Linux (Leap 15.4) with Python 3.10.11 built from source. pip install -v wxPython leads me directly into a build error:

  Running command: build_py
  Checking for /tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/bin/waf-2.0.24...
  "/home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/bin/python" /tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/bin/waf-2.0.24 --wx_config=/tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/build/wxbld/gtk3/wx-config --gtk3 --python="/home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/bin/python" --out=build/waf/3.10/gtk3 configure build
  Setting top to                           : /tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a
  Setting out to                           : /tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/build/waf/3.10/gtk3
  Checking for 'gcc' (C compiler)          : /usr/bin/gcc
  Checking for 'g++' (C++ compiler)        : /usr/bin/g++
  Checking for program 'python'            : /home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/bin/python
  Checking for python version >= 3.7.0     : 3.10.11
  python-config                            : not found
  Checking for library python3.10 in LIBDIR : yes
  Checking for header Python.h              : Distutils not installed? Broken python installation? Get python-config now!
  The configuration failed
  (complete log in /tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/build/waf/3.10/gtk3/config.log)
  Command '"/home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/bin/python" /tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/bin/waf-2.0.24 --wx_config=/tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/build/wxbld/gtk3/wx-config --gtk3 --python="/home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/bin/python" --out=build/waf/3.10/gtk3 configure build ' failed with exit code 1.
  Finished command: build_py (0m1.30s)
  Finished command: build (1m21.724s)
  Command '"/home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/bin/python" -u build.py build' failed with exit code 1.
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/bin/python -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d /tmp/pip-wheel-l8bfwyv2
  cwd: /tmp/pip-install-uk9gvb8g/wxpython_a0c02055c2ed4fd989fdb55af1dfa75a/
  Building wheel for wxPython (setup.py) ... error
  ERROR: Failed building wheel for wxPython
  Running setup.py clean for wxPython
  Running command python setup.py clean
  /home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/lib/python3.10/site-packages/setuptools/dist.py:755: SetuptoolsDeprecationWarning: Invalid dash-separated options
    opt = self.warn_dash_deprecation(opt, section)
  /home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/lib/python3.10/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
    parsed = self.parsers.get(option_name, lambda x: x)(value)
  /home/jacek/bin/tmp/Python-3.10.11/dist/displaycal/lib/python3.10/site-packages/setuptools/dist.py:955: DistDeprecationWarning: use_2to3 is ignored.
    ep.load()(self, ep.name, value)
  running clean
  'build/lib.linux-x86_64-cpython-310' does not exist -- can't clean it
  'build/bdist.linux-x86_64' does not exist -- can't clean it
  'build/scripts-3.10' does not exist -- can't clean it
Failed to build wxPython
ERROR: Could not build wheels for wxPython, which is required to install pyproject.toml-based projects

@swt2c
Copy link
Collaborator

swt2c commented May 16, 2023

@JacekRuzyczka, from your log:
python-config : not found

The build process couldn't find python-config. You need to ensure your built python-config is in your path.

@JakeOronaOE
Copy link

On my MacBook with OSX 13.3.1 run python3.11.3 (installed with brew). In a virtual environment (with pip and setuptools) I have installed: wheel, six, attrdict3, numpy, Pillow and at the end wxpython. And now, wxpython run :-)

This worked for me.

@AbhishekSRaut
Copy link

AbhishekSRaut commented May 22, 2023

I'm also facing same issue.
os: windows 11
python version: 3.11.3

C:\Users\abhishek>pip install wxPython
Defaulting to user installation because normal site-packages is not writeable
Collecting wxPython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      Traceback (most recent call last):
        File "C:\Users\abhishek\AppData\Roaming\Python\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\abhishek\AppData\Roaming\Python\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\abhishek\AppData\Roaming\Python\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\abhishek\AppData\Local\Temp\pip-build-env-1j3p841k\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\abhishek\AppData\Local\Temp\pip-build-env-1j3p841k\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "C:\Users\abhishek\AppData\Local\Temp\pip-build-env-1j3p841k\overlay\Lib\site-packages\setuptools\build_meta.py", line 488, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\abhishek\AppData\Local\Temp\pip-build-env-1j3p841k\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 27, in <module>
        File "C:\Users\abhishek\AppData\Local\Temp\pip-install-gz4amqb2\wxpython_8c929cd901fb41b093783e3e0d9335fb\buildtools\config.py", line 30, in <module>
          from attrdict import AttrDict
      ModuleNotFoundError: No module named 'attrdict'
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

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

Can anyone tell? how to install
note:
i already installed attrdict3 before installing wx-python

@sabdulmajid
Copy link

For what it's worth, I just wanted to say what worked for me:
I'm currently running a macOS Ventura 13.4, and my Python version is 3.11.3. I was trying to install MAVProxy, which has wxPython as one of its requirements I believe. And so I was running into the error of "metadata-generation-failed", to which I tried manually running pip install attrdict and also pip install attrdict3. Didn't work. So what I did was I manually pip uninstall attrdict & pip uninstall attrdict3, then reinstalled them manually (pip install attrdict & pip install attrdict3) to which my wxPython installed perfectly (after running pip install MAVProxy)

@AbhishekSRaut
Copy link

@sabdulmajid
I haven't install attrdict, so it wasn't presented in my packeges. as i install attrdict3, it still gives the error.
I think main problem is with attrdict3 module. I have tried to import it in normal file, still it gives same error, "module not found"
Maybe in mac its not the issue, but in windows i'm facing this.
I'm using windows 11.

@JacekRuzyczka
Copy link

@swt2c python-config is already installed on my system! Path: /home/jacek/bin/tmp/Python-3.10.11/build/python-config

@swt2c
Copy link
Collaborator

swt2c commented May 25, 2023

@JacekRuzyczka make sure it is in your $PATH.

@AbhishekSRaut
Copy link

@swt2c can you look this also?

@swt2c
Copy link
Collaborator

swt2c commented May 26, 2023

@swt2c can you look this also?

If you have attrdict3 installed (before trying to install wxPython, not at the same time), then I don't have any ideas for you.

@AbhishekSRaut
Copy link

If you have attrdict3 installed (before trying to install wxPython, not at the same time), then I don't have any ideas for you.

Then let's wait for the official release...

@GabrieleBattaglia
Copy link

GabrieleBattaglia commented May 26, 2023 via email

@TheQuinbox
Copy link

It's absolutely ridiculous that this is still an issue. Python 3.11 was released in October of last year. It's been over half a year, and people still have to do weird workarounds and hacks that A) they shouldn't have to do and B) that only work half the time. "So you have to install this, then that, then this, then open a particular command prompt and then it might work" is an absolutely awful developer experience.
If I publish a project on GitHub, my users shouldn't have to install either an older version of this library or an older version of Python just to run my code, especially not when it's an actively maintained library.
Utterly incompetent.

@GabrieleBattaglia
Copy link

GabrieleBattaglia commented May 29, 2023 via email

@swt2c
Copy link
Collaborator

swt2c commented Jun 8, 2023

New release 4.2.1 has been made with Python 3.11 wheels.

@swt2c swt2c closed this as completed Jun 8, 2023
@FrancescoChiossi
Copy link

FrancescoChiossi commented Aug 14, 2023

Hello all, I am also trying to install wxPython on Python 3.11 (Windows 10).

I tried pip install wxPython==4.2.1 but still did not work.

I need it to use eelbrain.

However, I tried to install all dependenices but wxPython still fails to build.

DId someone find out a complete solution? I read the entire thread but not finding one fitting for me.

Here the output:



 Checking for /tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5/bin/waf-2.0.19...
      "/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11" /tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5/bin/waf-2.0.19 --wx_config=/tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5/build/wxbld/gtk3/wx-config --gtk3 --python="/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11" --out=build/waf/3.1/gtk3 configure build
      Setting top to                           : /tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5
      Setting out to                           : /tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5/build/waf/3.1/gtk3
      Checking for 'gcc' (C compiler)          : /bin/gcc
      Checking for 'g++' (C++ compiler)        : /bin/g++
      Checking for program 'python'            : /home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11
      Checking for python version >= 2.7.0     : 3.11.1
      python-config                            : /opt/jupyterhub/bin/python3.11-config
      Asking python-config for pyext '--cflags --libs --ldflags' flags : yes
      Testing pyext configuration                                      : yes
      Finding libs for WX                                              : yes
      Finding libs for WXADV                                           : yes
      Finding libs for WXSTC                                           : yes
      Finding libs for WXHTML                                          : yes
      Finding libs for WXGL                                            : yes
      Finding libs for WXWEBVIEW                                       : yes
      Finding libs for WXXML                                           : yes
      Finding libs for WXXRC                                           : yes
      Finding libs for WXRICHTEXT                                      : yes
      Finding libs for WXMEDIA                                         : yes
      Finding libs for WXRIBBON                                        : yes
      Finding libs for WXPROPGRID                                      : yes
      Finding libs for WXAUI                                           : yes
      'configure' finished successfully (1.244s)
      Waf: Entering directory `/tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5/build/waf/3.1/gtk3'
      **** Compiler: /bin/gcc --version
           gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
           Copyright (C) 2021 Free Software Foundation, Inc.
           This is free software; see the source for copying conditions.  There is NO
           warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      [  1/921] Compiling sip/siplib/qtlib.c
      [  2/921] Compiling sip/siplib/bool.cpp
      [  3/921] Compiling sip/siplib/apiversions.c
      [  4/921] Compiling sip/siplib/objmap.c
      [  5/921] Compiling sip/siplib/voidptr.c
      [  6/921] Compiling sip/siplib/int_convertors.c
      [  7/921] Compiling sip/siplib/array.c
      [  8/921] Compiling sip/siplib/threads.c
      [  9/921] Compiling sip/siplib/descriptors.c
      [ 10/921] Compiling sip/siplib/siplib.c
      ../../../../sip/siplib/siplib.c: In function ‘sip_api_get_frame’:
      ../../../../sip/siplib/siplib.c:13750:22: error: invalid use of undefined type ‘struct _frame’
      13750 |         frame = frame->f_back;
            |                      ^~
      
      Waf: Leaving directory `/tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5/build/waf/3.1/gtk3'
      Build failed
       -> task in 'siplib' failed with exit status 1 (run with -v to display more information)
      Command '"/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11" /tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5/bin/waf-2.0.19 --wx_config=/tmp/pip-install-13lmk9pv/wxpython_ada4d602cbc340e4842654cc3fdb6de5/build/wxbld/gtk3/wx-config --gtk3 --python="/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11" --out=build/waf/3.1/gtk3 configure build ' failed with exit code 1.
      Finished command: build_py (0m2.222s)
      Finished command: build (1m8.46s)
      Command '"/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11" -u build.py build' failed with exit code 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for wxPython
  Running setup.py clean for wxPython
Failed to build wxPython
ERROR: Could not build wheels for wxPython, which is required to install pyproject.toml-based projects

@swt2c
Copy link
Collaborator

swt2c commented Aug 15, 2023

What happened when you tried to install wxPython 4.2.1? The log above is not from 4.2.1. Releases older than 4.2.1 will not work with Python 3.11.

@FrancescoChiossi
Copy link

Apologies for the confusing report.

Here is the terminal output when I try with: pip install wxpython==4.2.1

It seems an issue with building the wheel, as before showing the log it takes some minutes.

   /home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11 setup-wxsvg.py build_ext --inplace
      Compiling wx/svg/_nanosvg.pyx because it changed.
      [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 "/tmp/pip-install-z3925wux/wxpython_ca98f6b81e0545229acf2e5ced415b12/setup-wxsvg.py", line 54, in <module>
          modules = cythonize([module],
                    ^^^^^^^^^^^^^^^^^^^
        File "/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: wx/svg/_nanosvg.pyx
      Command '/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11 setup-wxsvg.py build_ext --inplace' failed with exit code 1.
      Finished command: build_others (0.785s)
      Finished command: build_py (2m4.637s)
      Finished command: build (3m7.882s)
      Command '"/home/ru74yig/CHI24_VisualSearch/chi24_VisualSearch/bin/python3.11" -u build.py build' failed with exit code 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for wxpython
  Running setup.py clean for wxpython
Failed to build wxpython

@swt2c
Copy link
Collaborator

swt2c commented Aug 16, 2023

Are you sure that's Windows? It sure looks like Linux. In any event, you're seeing an error when building with newer Cython (that I've already fixed but not in a new release). You can try pip install cython==0.29.36 and then try installing wxPython.

@FrancescoChiossi
Copy link

It did the job, thank you! 🥳

@jvasanthbalaji
Copy link

hi am using Python 3.7.8 and try to install pip install -U wxPython
but results in the below ,could anyone help me
Collecting numpy (from wxPython)
Using cached numpy-1.21.6-cp37-cp37m-win_amd64.whl (14.0 MB)
Building wheels for collected packages: wxPython
Building wheel for wxPython (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for wxPython (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
running bdist_wheel
running build
Will build using: "C:\Users\AppData\Local\Programs\Python\Python37\python.exe"
3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)]
Python's architecture is 64bit
cfg.VERSION: 4.2.1

  Running command: build
  Running command: build_wx
  Traceback (most recent call last):
    File "build.py", line 2377, in <module>
      main(sys.argv[1:])
    File "build.py", line 208, in main
      function(options, args)
    File "build.py", line 1452, in cmd_build
      cmd_build_wx(options, args)
    File "build.py", line 1462, in cmd_build_wx
      checkCompiler()
    File "build.py", line 795, in checkCompiler
      info = getMSVCInfo(PYTHON, arch, set_env=True)
    File "C:\Users\AppData\Local\Temp\pip-install-m0okaqyh\wxpython_3fa8c68b405f4f94bcc736954a60ad78\buildtools\config.py", line 993, in getMSVCInfo
      from attrdict import AttrDict
  ModuleNotFoundError: No module named 'attrdict'
  Finished command: build_wx (0.0s)
  Finished command: build (0.0s)
  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\python.exe" -u build.py build
  Command '"C:\Users\AppData\Local\Programs\Python\Python37\python.exe" -u build.py build' failed with exit code 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for wxPython
Failed to build wxPython
ERROR: Could not build wheels for wxPython, which is required to install pyproject.toml-based projects

@swt2c
Copy link
Collaborator

swt2c commented Aug 23, 2023

hi am using Python 3.7.8 and try to install pip install -U wxPython

I would recommend upgrading your Python version. Python 3.7 is end of life and we don't have wheels for it anymore.

lekv added a commit to lekv/chirp that referenced this issue Aug 11, 2024
I noticed that wxPython couldn't be installed as a dependency with
Python 3.12 on MacOS. It failed with the following error message:

ModuleNotFoundError: No module named 'attrdict'

After consulting wxWidgets/Phoenix#2296, I
found out that this was an issue with wxPython and confirmed that 4.2.1
works. I tested this locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests