ImportError: cannot import name 'Mapping' from 'collections'

When I try to install wxPython with pip I get this message:

C:\Users\name>py -m pip install -U wxPython
Collecting wxPython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata ( … error
error: subprocess-exited-with-error

× python 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 “C:\Users\name\AppData\Local\Temp\pip-install-m0kd10hi\wxpython_a0b80c06290645f2aeaebbebd8ac1324\”, line 27, in
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
File “C:\Users\name\AppData\Local\Temp\pip-install-m0kd10hi\wxpython_a0b80c06290645f2aeaebbebd8ac1324\buildtools\”, line 30, in
from attrdict import AttrDict
File “C:\Users\name\AppData\Local\Programs\Python\Python311\Lib\site-packages\”, line 5, in
from attrdict.mapping import AttrMap
File “C:\Users\name\AppData\Local\Programs\Python\Python311\Lib\site-packages\attrdict\”, line 4, in
from collections import Mapping
ImportError: cannot import name ‘Mapping’ from ‘collections’ (C:\Users\name\AppData\Local\Programs\Python\Python311\Lib\
[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.