Closed mattbryson closed 7 years ago
Should be fixed by #505
Issue still persists for me.
It also persists in my case too
@Rusbens1 @iruriksl can you folks please post your logs
@akshayaurora Not fixed. Just found this page when using latest kivy, latest buildozer.
$ python --version Python 3.6.4 :: Anaconda, Inc. macOS 10.13.3 (17D47)
$ buildozer osx debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for osx
# Check if kivy-sdk-packager exists
# kivy-sdk-packager does not exist, clone it
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 127 0 127 0 0 444 0 --:--:-- --:--:-- --:--:-- 444
100 193k 0 193k 0 0 255k 0 --:--:-- --:--:-- --:--:-- 255k
Archive: master.zip
1af58fde2b1442369c03dfaf836fccba866a0555
creating: kivy-sdk-packager-master/
inflating: kivy-sdk-packager-master/.gitignore
inflating: kivy-sdk-packager-master/LICENSE
inflating: kivy-sdk-packager-master/README.md
extracting: kivy-sdk-packager-master/__init__.py
inflating: kivy-sdk-packager-master/appveyor.yml
creating: kivy-sdk-packager-master/linux/
creating: kivy-sdk-packager-master/linux/debian/
inflating: kivy-sdk-packager-master/linux/debian/README.md
creating: kivy-sdk-packager-master/linux/debian/daily/
inflating: kivy-sdk-packager-master/linux/debian/daily/changelog
extracting: kivy-sdk-packager-master/linux/debian/daily/compat
inflating: kivy-sdk-packager-master/linux/debian/daily/control
inflating: kivy-sdk-packager-master/linux/debian/daily/copyright
extracting: kivy-sdk-packager-master/linux/debian/daily/kivy-doc.docs
extracting: kivy-sdk-packager-master/linux/debian/daily/kivy-examples.install
inflating: kivy-sdk-packager-master/linux/debian/daily/kivy-tools.install
inflating: kivy-sdk-packager-master/linux/debian/daily/python-kivy.install
inflating: kivy-sdk-packager-master/linux/debian/daily/python3-kivy.install
inflating: kivy-sdk-packager-master/linux/debian/daily/rules
creating: kivy-sdk-packager-master/linux/debian/stable/
inflating: kivy-sdk-packager-master/linux/debian/stable/changelog
extracting: kivy-sdk-packager-master/linux/debian/stable/compat
inflating: kivy-sdk-packager-master/linux/debian/stable/control
inflating: kivy-sdk-packager-master/linux/debian/stable/copyright
extracting: kivy-sdk-packager-master/linux/debian/stable/kivy-doc.docs
extracting: kivy-sdk-packager-master/linux/debian/stable/kivy-examples.install
inflating: kivy-sdk-packager-master/linux/debian/stable/kivy-tools.install
inflating: kivy-sdk-packager-master/linux/debian/stable/python-kivy-bin.install
extracting: kivy-sdk-packager-master/linux/debian/stable/python-kivy-common.install
inflating: kivy-sdk-packager-master/linux/debian/stable/python-kivy.install
inflating: kivy-sdk-packager-master/linux/debian/stable/python3-kivy-bin.install
extracting: kivy-sdk-packager-master/linux/debian/stable/python3-kivy-common.install
inflating: kivy-sdk-packager-master/linux/debian/stable/python3-kivy.install
inflating: kivy-sdk-packager-master/linux/debian/stable/rules
creating: kivy-sdk-packager-master/osx/
inflating: kivy-sdk-packager-master/osx/README.md
inflating: kivy-sdk-packager-master/osx/cleanup_app.sh
inflating: kivy-sdk-packager-master/osx/create-osx-bundle.sh
inflating: kivy-sdk-packager-master/osx/create-osx-dmg.sh
creating: kivy-sdk-packager-master/osx/data/
inflating: kivy-sdk-packager-master/osx/data/MakeSymlinks
inflating: kivy-sdk-packager-master/osx/data/background.png
inflating: kivy-sdk-packager-master/osx/data/icon.icns
inflating: kivy-sdk-packager-master/osx/data/link_duplicate.py
inflating: kivy-sdk-packager-master/osx/data/script
inflating: kivy-sdk-packager-master/osx/package_app.py
creating: kivy-sdk-packager-master/win/
inflating: kivy-sdk-packager-master/win/DST Root CA X3.pem
extracting: kivy-sdk-packager-master/win/__init__.py
inflating: kivy-sdk-packager-master/win/angle.py
inflating: kivy-sdk-packager-master/win/common.py
creating: kivy-sdk-packager-master/win/data/
inflating: kivy-sdk-packager-master/win/data/README.txt
inflating: kivy-sdk-packager-master/win/data/kivy-bash.bat
inflating: kivy-sdk-packager-master/win/data/kivy.bat
inflating: kivy-sdk-packager-master/win/data/kivybash.rc
inflating: kivy-sdk-packager-master/win/data/kivyenv.sh
inflating: kivy-sdk-packager-master/win/data/kivywineenv.sh
creating: kivy-sdk-packager-master/win/data/tools/
inflating: kivy-sdk-packager-master/win/data/tools/cython.bat
extracting: kivy-sdk-packager-master/win/data/tools/easy_install.bat
inflating: kivy-sdk-packager-master/win/data/tools/link_msysgit.bat
inflating: kivy-sdk-packager-master/win/data/tools/make-portable-python.py
extracting: kivy-sdk-packager-master/win/data/tools/pip.bat
inflating: kivy-sdk-packager-master/win/data/tools/register-python.py
inflating: kivy-sdk-packager-master/win/dropbox.py
inflating: kivy-sdk-packager-master/win/gdrive.py
inflating: kivy-sdk-packager-master/win/glew.py
inflating: kivy-sdk-packager-master/win/gstreamer.py
inflating: kivy-sdk-packager-master/win/kivy_win_sdk.py
inflating: kivy-sdk-packager-master/win/readme
inflating: kivy-sdk-packager-master/win/sdl2.py
# check if Kivy.app exists in local dir
Traceback (most recent call last):
File "/Users/shawley/anaconda3/bin/buildozer", line 11, in <module>
load_entry_point('buildozer==0.35.dev0', 'console_scripts', 'buildozer')()
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/__init__.py", line 1058, in run_command
self.target.run_commands(args)
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 232, in run_commands
func(args)
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 245, in cmd_debug
self.buildozer.prepare_for_build()
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/__init__.py", line 173, in prepare_for_build
self.target.check_requirements()
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 99, in check_requirements
self.ensure_kivyapp()
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 86, in ensure_kivyapp
if not int(py_branch) in (2, 3):
ValueError: invalid literal for int() with base 10: '3.6.4'
Scotts-MacBook-Pro-3:sorta shawley$ buildozer osx debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for osx
# Check if kivy-sdk-packager exists
# kivy-sdk-packager found at /Users/shawley/github/sorta/.buildozer/osx/platform
# check if Kivy.app exists in local dir
# Downloading kivy...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 178 0 0 1745 0 --:--:-- --:--:-- --:--:-- 1745
100 162 100 162 0 0 543 0 --:--:-- --:--:-- --:--:-- 543
# Extracting and installing Kivy...
hdiutil: attach failed - image not recognized
Traceback (most recent call last):
File "/Users/shawley/anaconda3/bin/buildozer", line 11, in <module>
load_entry_point('buildozer==0.35.dev0', 'console_scripts', 'buildozer')()
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/__init__.py", line 1058, in run_command
self.target.run_commands(args)
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 232, in run_commands
func(args)
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 245, in cmd_debug
self.buildozer.prepare_for_build()
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/__init__.py", line 173, in prepare_for_build
self.target.check_requirements()
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 99, in check_requirements
self.ensure_kivyapp()
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 93, in ensure_kivyapp
self.download_kivy(kivy_app_dir, py_branch)
File "/Users/shawley/anaconda3/lib/python3.6/site-packages/buildozer/targets/osx.py", line 77, in download_kivy
check_call(('hdiutil', 'attach', cwd + '/Kivy{}.dmg'.format(py_branch)))
File "/Users/shawley/anaconda3/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('hdiutil', 'attach', '/Users/shawley/github/sorta/.buildozer/osx/platform/kivy-sdk-packager-master/osx/Kivy3.dmg')' returned non-zero exit status 1.
Hi,
I received the same error when I've tried to package a kivy app on macOS Sierra 10.12.6 using buildozer.
Is there any workaround to fix this?
python --version
Python 3.6.2
buildozer --version
# Check configuration tokens
Buildozer 0.34
buildozer -v osx debug
# Check configuration tokens
# Ensure build layout
# Create directory /Volumes/Data/Development/ws/python/BfAndroidServer/.buildozer/osx/platform
# Create directory /Volumes/Data/Development/ws/python/BfAndroidServer/.buildozer/osx/app
# Check configuration tokens
# Preparing build
# Check requirements for osx
# Check if kivy-sdk-packager exists
# kivy-sdk-packager does not exist, clone it
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 127 0 127 0 0 224 0 --:--:-- --:--:-- --:--:-- 224
100 193k 0 193k 0 0 140k 0 --:--:-- 0:00:01 --:--:-- 398k
Archive: master.zip
7582d96094e5fc3ea3e2991241fbfa667e9791f3
creating: kivy-sdk-packager-master/
inflating: kivy-sdk-packager-master/.gitignore
inflating: kivy-sdk-packager-master/LICENSE
inflating: kivy-sdk-packager-master/README.md
extracting: kivy-sdk-packager-master/__init__.py
inflating: kivy-sdk-packager-master/appveyor.yml
creating: kivy-sdk-packager-master/linux/
creating: kivy-sdk-packager-master/linux/debian/
inflating: kivy-sdk-packager-master/linux/debian/README.md
creating: kivy-sdk-packager-master/linux/debian/daily/
inflating: kivy-sdk-packager-master/linux/debian/daily/changelog
extracting: kivy-sdk-packager-master/linux/debian/daily/compat
inflating: kivy-sdk-packager-master/linux/debian/daily/control
inflating: kivy-sdk-packager-master/linux/debian/daily/copyright
extracting: kivy-sdk-packager-master/linux/debian/daily/kivy-doc.docs
extracting: kivy-sdk-packager-master/linux/debian/daily/kivy-examples.install
inflating: kivy-sdk-packager-master/linux/debian/daily/kivy-tools.install
inflating: kivy-sdk-packager-master/linux/debian/daily/python-kivy.install
inflating: kivy-sdk-packager-master/linux/debian/daily/python3-kivy.install
inflating: kivy-sdk-packager-master/linux/debian/daily/rules
creating: kivy-sdk-packager-master/linux/debian/stable/
inflating: kivy-sdk-packager-master/linux/debian/stable/changelog
extracting: kivy-sdk-packager-master/linux/debian/stable/compat
inflating: kivy-sdk-packager-master/linux/debian/stable/control
inflating: kivy-sdk-packager-master/linux/debian/stable/copyright
extracting: kivy-sdk-packager-master/linux/debian/stable/kivy-doc.docs
extracting: kivy-sdk-packager-master/linux/debian/stable/kivy-examples.install
inflating: kivy-sdk-packager-master/linux/debian/stable/kivy-tools.install
inflating: kivy-sdk-packager-master/linux/debian/stable/python-kivy-bin.install
extracting: kivy-sdk-packager-master/linux/debian/stable/python-kivy-common.install
inflating: kivy-sdk-packager-master/linux/debian/stable/python-kivy.install
inflating: kivy-sdk-packager-master/linux/debian/stable/python3-kivy-bin.install
extracting: kivy-sdk-packager-master/linux/debian/stable/python3-kivy-common.install
inflating: kivy-sdk-packager-master/linux/debian/stable/python3-kivy.install
inflating: kivy-sdk-packager-master/linux/debian/stable/rules
creating: kivy-sdk-packager-master/osx/
inflating: kivy-sdk-packager-master/osx/README.md
inflating: kivy-sdk-packager-master/osx/cleanup_app.sh
inflating: kivy-sdk-packager-master/osx/create-osx-bundle.sh
inflating: kivy-sdk-packager-master/osx/create-osx-dmg.sh
creating: kivy-sdk-packager-master/osx/data/
inflating: kivy-sdk-packager-master/osx/data/MakeSymlinks
inflating: kivy-sdk-packager-master/osx/data/background.png
inflating: kivy-sdk-packager-master/osx/data/icon.icns
inflating: kivy-sdk-packager-master/osx/data/link_duplicate.py
inflating: kivy-sdk-packager-master/osx/data/script
inflating: kivy-sdk-packager-master/osx/package_app.py
creating: kivy-sdk-packager-master/win/
inflating: kivy-sdk-packager-master/win/DST Root CA X3.pem
extracting: kivy-sdk-packager-master/win/__init__.py
inflating: kivy-sdk-packager-master/win/angle.py
inflating: kivy-sdk-packager-master/win/common.py
creating: kivy-sdk-packager-master/win/data/
inflating: kivy-sdk-packager-master/win/data/README.txt
inflating: kivy-sdk-packager-master/win/data/kivy-bash.bat
inflating: kivy-sdk-packager-master/win/data/kivy.bat
inflating: kivy-sdk-packager-master/win/data/kivybash.rc
inflating: kivy-sdk-packager-master/win/data/kivyenv.sh
inflating: kivy-sdk-packager-master/win/data/kivywineenv.sh
creating: kivy-sdk-packager-master/win/data/tools/
inflating: kivy-sdk-packager-master/win/data/tools/cython.bat
extracting: kivy-sdk-packager-master/win/data/tools/easy_install.bat
inflating: kivy-sdk-packager-master/win/data/tools/link_msysgit.bat
inflating: kivy-sdk-packager-master/win/data/tools/make-portable-python.py
extracting: kivy-sdk-packager-master/win/data/tools/pip.bat
inflating: kivy-sdk-packager-master/win/data/tools/register-python.py
inflating: kivy-sdk-packager-master/win/dropbox.py
inflating: kivy-sdk-packager-master/win/gdrive.py
inflating: kivy-sdk-packager-master/win/glew.py
inflating: kivy-sdk-packager-master/win/gstreamer.py
inflating: kivy-sdk-packager-master/win/kivy_win_sdk.py
inflating: kivy-sdk-packager-master/win/readme
inflating: kivy-sdk-packager-master/win/sdl2.py
# check if Kivy.app exists in local dir
# Downloading kivy...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 178 0 0 793 0 --:--:-- --:--:-- --:--:-- 794
100 162 100 162 0 0 255 0 --:--:-- --:--:-- --:--:-- 843
# Extracting and installing Kivy...
hdiutil: attach failed - image not recognized
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/buildozer", line 11, in <module>
load_entry_point('buildozer==0.34', 'console_scripts', 'buildozer')()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/buildozer/__init__.py", line 1058, in run_command
self.target.run_commands(args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/buildozer/targets/osx.py", line 232, in run_commands
func(args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/buildozer/targets/osx.py", line 245, in cmd_debug
self.buildozer.prepare_for_build()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/buildozer/__init__.py", line 173, in prepare_for_build
self.target.check_requirements()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/buildozer/targets/osx.py", line 99, in check_requirements
self.ensure_kivyapp()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/buildozer/targets/osx.py", line 93, in ensure_kivyapp
self.download_kivy(kivy_app_dir, py_branch)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/buildozer/targets/osx.py", line 77, in download_kivy
check_call(('hdiutil', 'attach', cwd + '/Kivy{}.dmg'.format(py_branch)))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('hdiutil', 'attach', '/Volumes/Data/Development/ws/python/BfAndroidServer/.buildozer/osx/platform/kivy-sdk-packager-master/osx/Kivy3.dmg')' returned non-zero exit status 1.
Hi,
I was able to locate the problem and fix the error.
Considering you are using python3, the main problem is that if buildozer doesn't find a file called Kivy3.app it tries to download a dmg file from http://kivy.org/downloads/1.10.0/Kivy-1.10.0-osx-python3.dmg which obviously does not exist. Thus the downloaded file is invalid and hdiutil ist not able to attach it. And here, the long way of the journey to fix that problem begins :-D
The big hurdle to overcome is to generate your own Kivy3.app inside the temporary directory .buildozer/osx/platform/kivy-sdk-packager-master/osx using the script "create-osx-bundle.sh", modify your buildozer installation to use python3 and fix the local python script package_app.py
. Here are the steps to run everything on a fresh installed macOS Sierra 10.12.6. Finally, you got your packaged application as dmg-file. There is place for some optimization to speed up your build, but I leave this as an exercise ;-)
#!/usr/bin/env bash
which brew > /dev/null && echo "Homebrew is already installed..." || /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python3 wget
sudo ln -s /usr/local/bin/pip3 /usr/local/bin/pip
if [[ $(which java > /dev/null; echo $?) != "0" ]]; then pushd ~/Downloads wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-macosx-x64.dmg hdiutil attach jdk-8u171-macosx-x64.dmg && sudo /usr/sbin/installer -pkg /Volumes/JDK\ 8\ Update\ 171/JDK\ 8\ Update\ 171.pkg -target / hdiutil detach /Volumes/JDK\ 8\ Update\ 171/ rm jdk-8u171-macosx-x64.dmg popd else echo "Java is already installed..." fi
brew install gradle
if [[ $(which sdkmanager > /dev/null; echo $?) != "0" ]]; then pushd ~/Downloads wget https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip unzip sdk-tools-darwin-3859397.zip rm sdk-tools-darwin-3859397.zip mkdir -p ~/Library/Frameworks/Android && sudo @mv tools ~/Library/Frameworks/Android PATH=$PATH:~/Library/Frameworks/Android/tools/bin/ && export PATH popd else echo "Android sdkmanager is already installed..." fi
yes | sdkmanager --licenses sdkmanager "platforms;android-21" sdkmanager "build-tools;27.0.3"
if [ ! -d ~/Library/Frameworks/crystax-ndk-10.3.2 ]; then pushd ~/Downloads wget https://www.crystax.net/download/crystax-ndk-10.3.2-darwin-x86_64.tar.xz tar xf crystax-ndk-10.3.2-darwin-x86_64.tar.xz rm crystax-ndk-10.3.2-darwin-x86_64.tar.xz sudo mv crystax-ndk-10.3.2 ~/Library/Frameworks popd else echo "CrystaX NDK 10.3.2 is already installed..." fi
pip3 install "cython == 0.25.2"
pip3 install "python-for-android == 0.6.0" pip3 install "kivy = 1.10.0"
pip3 install "virtualenv == 16.0.0"
pip3 install "buildozer == 0.34"
############################################
############################################
if [[ $(which platypus > /dev/null; echo $?) != "0" ]]; then pushd ~/Downloads wget https://www.sveinbjorn.org/files/software/platypus/platypus5.2.zip unzip platypus5.2.zip rm platypus5.2.zip
sudo cp Platypus-5.2/Platypus.app/Contents/Resources/platypus_clt /usr/local/bin/
sudo mv /usr/local/bin/platypus_clt /usr/local/bin/platypus
sudo mkdir -p /usr/local/share/platypus
sudo cp Platypus-5.2/Platypus.app/Contents/Resources/ScriptExec /usr/local/share/platypus
sudo chmod +x /usr/local/share/platypus/ScriptExec
sudo cp -R Platypus-5.2/Platypus.app/Contents/Resources/MainMenu.nib /usr/local/share/platypus
rm -Rf Platypus-5.2
popd
else echo "Platypus is already installed..." fi
if [[ ! -d /Library/Frameworks/GStreamer.framework ]]; then pushd ~/Downloads
# You need both, gstreamer runtime binaries and libs and the development package including the headers.
wget https://gstreamer.freedesktop.org/data/pkg/osx/1.14.0/gstreamer-1.0-devel-1.14.0-x86_64.pkg
sudo /usr/sbin/installer -pkg gstreamer-1.0-devel-1.14.0-x86_64.pkg -target /
rm gstreamer-1.0-devel-1.14.0-x86_64.pkg
wget https://gstreamer.freedesktop.org/data/pkg/osx/1.14.0/gstreamer-1.0-1.14.0-x86_64.pkg
sudo /usr/sbin/installer -pkg gstreamer-1.0-1.14.0-x86_64.pkg -target /
rm gstreamer-1.0-1.14.0-x86_64.pkg
popd
else echo "GStreamer is already installed..." fi
if [[ ! -d /Library/Frameworks/SDL2.framework ]]; then pushd ~/Downloads wget https://www.libsdl.org/release/SDL2-2.0.4.dmg hdiutil attach SDL2-2.0.4.dmg && sudo cp -R /Volumes/SDL2/SDL2.framework /Library/Frameworks hdiutil detach /Volumes/SDL2 rm SDL2-2.0.4.dmg popd else echo "SDL2 is already installed..." fi
if [[ ! -d /Library/Frameworks/SDL2_image.framework ]]; then pushd ~/Downloads wget https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.dmg hdiutil attach SDL2_image-2.0.1.dmg && sudo cp -R /Volumes/SDL2_image/SDL2_image.framework /Library/Frameworks hdiutil detach /Volumes/SDL2_image rm SDL2_image-2.0.1.dmg popd else echo "SDL2_image is already installed..." fi
if [[ ! -d /Library/Frameworks/SDL2_ttf.framework ]]; then pushd ~/Downloads wget https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.dmg hdiutil attach SDL2_ttf-2.0.14.dmg && sudo cp -R /Volumes/SDL2_ttf/SDL2_ttf.framework /Library/Frameworks hdiutil detach /Volumes/SDL2_ttf rm SDL2_ttf-2.0.14.dmg popd else echo "SDL2_ttf is already installed..." fi
if [[ ! -d /Library/Frameworks/SDL2_mixer.framework ]]; then pushd ~/Downloads wget https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg hdiutil attach SDL2_mixer-2.0.1.dmg && sudo cp -R /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks hdiutil detach /Volumes/SDL2_mixer rm SDL2_mixer-2.0.1.dmg popd else echo "SDL2_mixer is already installed..." fi
if [[ ! -f /usr/local/lib/libintl.8.dylib ]]; then brew install gettext sudo ln -s /usr/local/Cellar/gettext/0.19.8.1/lib/libintl.8.dylib /usr/local/lib/ else echo "libintl.8.dylib is already installed..." fi
2. Run this script inside your project root:
### build_for_osx.sh
PYTHON_VERSION="3.6.5" PYTHON_EXEC_VERSION="python3.6"
pushd /usr/local/lib/$PYTHON_EXEC_VERSION/site-packages/buildozer sed -i '' 's;virtualenv --python=python2.7;virtualenv --python=python3.6;g' init.py popd
pushd /usr/local/lib/$PYTHON_EXEC_VERSION/site-packages/buildozer/targets sed -i '' "s;'python', 'package_app.py';'python3', 'package_app.py';g" osx.py popd
buildozer osx debug if [[ "$?" != 0 ]]; then echo "[INFO] First run of buildozer failed as expected." fi
pushd .buildozer/osx/platform/kivy-sdk-packager-master/osx rm -Rf Kivy3.dmg sed -i '' "s;3.5.0;$PYTHON_VERSION;g" create-osx-bundle.sh sed -i '' "s;python3.5;$PYTHON_EXEC_VERSION;g" create-osx-bundle.sh sed -i '' "s;rm {};rm -f {};g" create-osx-bundle.sh ./create-osx-bundle.sh python3
pushd Kivy.app/Contents/Resources/venv/bin/ rm ./python3 ln -s ../../../Frameworks/python/$PYTHON_VERSION/bin/python3 . popd
pushd .buildozer/osx/platform/kivy-sdk-packager-master/osx sed -i '' "s;3.5.0;$PYTHON_VERSION;g" package_app.py
sed -i '' "s;.decode('utf-8');;g" package_app.py popd
popd
buildozer osx debug
I was able to locate the problem and fix the error.
This has been extremely helpful in helping me to get kivy to build in MacOS (via GitHub actions) using buildozer. I'm not sure why this isn't documented on the official documentation, since it's--what--2 years old?
I did find a couple issues
./create-osx-bundle.sh
-- which now takes the version of kivy followed by the version of python. So change./create-osx-bundle.sh python3
to this (or similar):
./create-osx-bundle.sh 1.11.1 3.7.3
## Change buildozer to use a python3.7 virtual environment instead of python2.7
#pushd /usr/local/lib/$PYTHON_EXEC_VERSION/site-packages/buildozer
#sed -i '' 's;virtualenv --python=python2.7;virtualenv --python=python3.7;g' __init__.py
#popd
#
## Change the osx target to use python3 to run the package_app.py script.
#pushd /usr/local/lib/$PYTHON_EXEC_VERSION/site-packages/buildozer/targets
#sed -i '' "s;'python', 'package_app.py';'python3', 'package_app.py';g" osx.py
#popd
I had to remove 'python3' from the list of requirements in the buildozer.spec file, else it tries to do a pip3 install python3
, which of course fails (not sure why this is the default in the spec file from buildozer init
I had to add a bogus item to requirements.txt, because if 'kivy' is the only item, it throws a fit. I put pip in it, so the requirements.txt
file's contents is:
kivy
pip
sed
command to drop the decode
of utf-8
actually breaks it, and I needed to remove it#sed -i '' "s;\.decode('utf-8');;g" package_app.py
I'm almost there: currently everything works except the python binary that's shipped with buildozer at myapp.app/Contents/Resources/python
. Not sure why, but apparently the python
binaries downloaded by buildozer
via pyenv
change every execution. smh.
@maltfield @astahlhofen Were you ever able to figure this issue out? I am currently struggling with the same issue and have not been able to get the above strategy to work. Any help would be really appreciated!
I recommend that you just fork this repo. It has build scripts that "just work" to spit-out a self-contained kivy executable app in Linux, Windows, and MacOS:
I ended up abandoning buildzoer (mainly because the python binary it was downloading through the ridiculously complex process described above differs on every execution and therefore wasn't deterministic). I spent days on it, then got PyInstaller working in less than a day.
I built the above-linked repo to make this easier for folks to build apps in kivy without having to setup a build environment and fight with the build tools like I did for about a month.
Related to #427
Appears to to be a few issues happening here.
1) Fails to find local install of the
kivy.app
so downloads it 2) Fails to downloadkeka
as part of the installation ofkivy
I have tried with
Kivy
as pip package, withKivy.app
in/Applications
, withKivy.app
in local dir.
and with all 3 at once.buildozer
always tries to downloadKivy
.I installed
buildozer
with bothand
I made the simple pong tutorial, and the app runs fine with a
pip
install ofKivy
.See below for details...
Verify
Kivy
Verify
python
Verify app runs
Verify
buildozer
Attempt to Package app