Installing wxPython using pip3 on M1 processor fails with the following error

286 views
Skip to first unread message

Nischith Honnavar

unread,
Jan 5, 2022, 2:38:39 PM1/5/22
to wxPython-dev
Hi all, 
I have trouble installing wxPython on M1 processor using pip command.
        python3 -m pip install -U --user wxPython==4.1.1

It errors out with the following errors, any help would be greatly appreciated.
/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/ext/wxWidgets/src/common/imagtiff.cpp:37:14: fatal error: 'tiff.h' file not found
#include "tiff.h"
^~~~~~~~
1 error generated.
/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/build/wxbld/bk-deps g++ -std=gnu++11 -mmacosx-version-min=10.10 -c -o coredll_menucmn.o -I/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/ext/wxWidgets/src/jpeg -I/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/ext/wxWidgets/src/png -I/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/ext/wxWidgets/src/zlib -I/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/ext/wxWidgets/src/regex -I/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/build/wxbld/lib/wx/include/osx_cocoa-unicode-3.1 -I/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/ext/wxWidgets/include -D_FILE_OFFSET_BITS=64 -D__WXOSX_COCOA__ -DWXBUILDING -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-deprecated-declarations -O2 -fno-common -fvisibility=hidden -fvisibility-inlines-hidden /private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/ext/wxWidgets/src/common/menucmn.cpp
make: *** [coredll_imagtiff.o] Error 1
make: *** Waiting for unfinished jobs....
Error building
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/build.py", line 1510, in cmd_build_wx
wxbuild.main(wxDir(), build_options)
File "/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/buildtools/build_wxwidgets.py", line 496, in main
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
File "/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/buildtools/build_wxwidgets.py", line 85, in exitIfError
raise builder.BuildError(msg)
buildtools.builder.BuildError: Error building
Finished command: build_wx (1m18.625s)
Finished command: build (1m18.625s)
Command '"/usr/local/bin/python3" -u build.py build' failed with exit code 1.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/setup.py'"'"'; __file__='"'"'/private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-install-te45wdfi/wxpython_1817d47724b04219aa27ca5509320abb/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/_t/2_vmtfvn7f51ssklbmsvtqcm0000gn/T/pip-record-cf6hmtvk/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/plswtest/Library/Python/3.10/include/python3.10/wxPython Check the logs for full command output.

Thanks,
Nischith

Robin Dunn

unread,
Jan 5, 2022, 6:00:13 PM1/5/22
to wxPython-dev
This has been fixed in recent updates. You can try a 4.1.2 prerelease build from https://wxpython.org/Phoenix/snapshot-builds. There are source archive files there that should be able to be built by pip, and there are also binaries if you want to avoid the build. You can either grab the files and work with them locally, or you can tell pip to use them with a command like this:

python -m pip install --pre -f https://wxpython.org/Phoenix/snapshot-builds wxPython

Nischith Honnavar

unread,
Jan 7, 2022, 7:15:22 AM1/7/22
to wxPython-dev
Thanks Robin. I'll try the suggested version.

However, I found a workaround for building(wxPython-4.1.1) from sources, below is the recipe:
• brew install doxygen   #dependency for build step below
• git clone https://github.com/wxWidgets/Phoenix.git && cd Phoenix
• git checkout wxPython-4.1.1 
• git cherrypick b40ab0f806bdf7aa0c0a51a8c4876ac47754515d  #cherry-pick commit for resolving above python 3.10 issue
• git submodule update --init --recursive
• export CXXFLAGS=-I$(brew --prefix)/include
• python3 build.py dox etg --nodoc sip build 
• python3 setup.py install

Reply all
Reply to author
Forward
0 new messages