After hours of trial an error, I hope, somebody can help me here.
I got my MacBook Air (M1, 2020) and want to use kivy for python-programming on it. When I first bought the Laptop 3 month ago it took a lot of work to find a way to run kivy/ execute my kivy-code on it. Finally, I ended up with the Kivy.app version which created [please excuse my limited understanding...] a Application, I could drag my python-files on or execute the files via the command line like kivy main.py
. The "usual" way of simply installing kivy via pip
did never work (as far as I understood because the presented wheel is not compatible with the M1-Chip).
Now, I upgraded my MacOS to Monterey, which crashed everything. I can't even give a lot of information about what's broken. when I try to drag files on the Kivy-Application simply nothing happens. Executing any file (even a simple print("Hello")
via the command line (like kivy main.py
) results in
kivy
/Applications/Kivy.app/Contents/Resources/venv/bin /Applications/Kivy.app/Contents/Resources /Applications/Kivy.app/Contents/Resources
ImportError: No module named site
Since I don't use any special setup, just the fresh updated MacOS in it's newest version and python (installed via homebrew and already reinstalled after updating the OS) I hope anyone with more understanding of the how's and why's than me already fixed this problem for him/her self and can enlighten me.
Do you have installed Rosetta2, because Kivy.app is an Intel Application and cannot work w\\out that.
Install CLI Kivy Tools for Apple M1 Chip Mac
You need Homebrew and XCode, follow this guide:
Dependencies(for macOS): https://kivy.org/doc/stable/installation/installation-osx.html#install-source-osx You need one more dependecies: brew install ffmpeg
Install step: https://kivy.org/doc/stable/gettingstarted/installation.html#install-pip
Here you need go to step: "Development install".
After "python setup.py build_ext --inplace" or "make" command, you can do "sudo make install" to build kivy on python3 folder and remove folder you download before.
If in build you have error missing cython, you need to install cython from the source, you can do this from this: https://pypi.org/project/Cython/#description
I could run kivy on MacOS with M1 chip using rosetta 2.
Install rosetta 2
softwareupdate --install-rosetta
Start a terminal with rosetta. Right click to /Applications/iTerm or /Applicatins/Utilities/Terminal > Get Info > Open Using Rosetta
Create a fresh virtualenv. Install requirements
pip install kivy[base] kivy-examples
Run main.py (python main.py)
main.py
import kivy
kivy.require('2.0.0')
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.