Phoenix
Phoenix copied to clipboard
Build for Apple Silicon M1
I failed to build wxPython on my M1 Apple machine. I followed this blog post: https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html and installed the dependencies.
I installed all dependencies except libwebkitgtk via brew. I could not find a libwebkitgtk version for macOS somehow, but I think this is not the cause of the build failing.
I then tried to install wxPython through PyCharm.
The build fails with the error message:
/private/var/folders/02/yddw8xhd3k51v1b58vr31rr00000gn/T/pip-install-8_r_73_0/wxpython_7712cf33293c4850aba3ed497fed21c9/ext/wxWidgets/src/common/imagtiff.cpp:37:14: fatal error: 'tiff.h' file not found
Here is the full error log: wxpython build error log.txt
I tried brew reinstall libtiff without success.
If someone succeeded in building wxPython for Apple ARM M1, it would be kind to share the wheel. Maybe we could even supply an Apple ARM build for download as we do with the Linux builds https://extras.wxpython.org/wxPython4/extras/linux/
Update: I successfully run my wxPython project on my Apple Silicon M1 MacBook by following these steps:
- Install Python and wxPython via brew
brew install python wxPython - Open the project in PyCharm
- Add a new interpreter in PyCharm (Preferences > Project: ... > Python Interpreter > ⚙️ > Add...)
- Select Virtual Environment
- Set Base Interpreter to:
/opt/homebrew/bin/python3 - Select "Inherit global site-packages"
I have the same issue.
I can install it through Homebrew, but I can't install it through pip.
Python 3.9.7 from Homebrew, MacOS 11.5.2, XCode 12.5.1, M1 mac.
'tiff.h' file not found
As an aside, it would be nice to have an official M1 build on PyPI if that would be possible.
I believe that @RobinD42 is working on getting his build infrastructure updated in order to do universal mac builds.
Excellent, thanks for letting me know. I have a bit of concern about how long Rosetta 2 is going to be a thing, so for the time being I might make my own Apple Silicon-native build done.
If it's of any use, Scaleway are doing very cheap Apple M1 Mac Mini hosting now with VNC and SSH access - might be handy, might not.
via https://discuss.wxpython.org/t/wxpython-not-installing-via-pip-on-apple-silicon-m1-max/35697/9:
This works for me:
export CFLAGS=-I/$(brew --prefix)/include
export CXXFLAGS=-I/$(brew --prefix)/include
pip install wxPython
Fixed it for me as well.
export CFLAGS=-I/$(brew --prefix)/include
export CXXFLAGS=-I/$(brew --prefix)/include
worked for me as well with poetry