Tips

WSL2(Ubuntu) Buildozer Installation Verification Notes in Kivy

This article can be read in about 11 minutes.

This is a verification note for the administrator to install Buildozer on WSL2 (Ubuntu). It describes the results of the verification due to different dependencies and versions.

Distutils Library Deprecated in Python 3.12

Since Python 3.12, the distutils library used by Buldozer has been deprecated and integrated into the setuptools library. It seems to have been fixed in Buldozer 1.5.1dev0 (available on GitHub) accordingly.

Impact by distutils library

A Python file containing import statements for the distutils library can be found at the following location.

[< virtual environment folder >/lib/ < Python version > /site-packages/buildozer/targets/android.py]

The following import statement is on line 40

from distutils.version import LooseVersion

Fixes in Buldozer1.5.1dev0

There are probably other areas that have been modified in buildozerr1.5.1dev0, but at least the above statement has been eliminated. The method of using the setuptools library as an alternative is also not required.

How to Use the Setuptools Library as an Alternative

There seems to be another way to use the setuptools library by changing the above code to the following, but I don’t know if this affected it or not, but it didn’t work.

#from distutils.version import LooseVersion
from setuptools._distutils.version import LooseVersion
pip install setuptools

The libtinfo5 Package Is No Longer Available

The libtinfo5 package is no longer provided in Ubuntu 23.04 and later.

libtinfo5 is specified as a package to be installed by the official Buildozer website, but this is not installable on Ubontu 24.4 with the message “Unable to locate package libtinfo5”.

libtinfo5 is part of the ncurses (new curses) package libtinfo5 seems to be related to an older version of ncurses. ncurses is a terminal control library that creates text-based UI, including window creation, drawing and keyboard control. It is a package for creating text-based UIs such as window creation, drawing and keyboard control. In newer versions of ncurses, libncurses6 is installed as standard from Ubuntu 22.4 onwards. libtinfo5 and 6 do not seem to be compatible. libncurses6 or libtinfo6 is not required, but both I don’t know whether I need libncurses6 or libtinfo6, but I installed both.

WSL2 Ubuntu Version Differences

It seems to be affected by different versions of Ubuntu.

Ubuntu 24.04.1

On Ubuntu 24.04.1, Python3.12.3 is installed in [usr/bin].

Python3.12.7 buildozer1.5.1dev0 libtinfo6

I proceeded without installing libncurses5 and libtinfo6. The process stops with “Aidl not found”.

# Check that aidl can be executed
# build-tools folder not found /home/user/.buildozer/android/platform/android-sdk/build-tools
# Search for Aidl
# Search for Aidl not found, please install it.

I installed libncurses5, libtinfo6 and Aidl and tried again, the process proceeded but now it stops with many glibc (GNU C Library) related errors.

The function-like macro '__GNUC_PREREQ' is not defined

Python3.10.15 / Python3.11.10 buildozer1.5.0 libtinfo6

I installed buildozer1.5.1dev0 without installing libncurses5 and libtinfo6 and proceeded to install them, but I got angry with “Aidl not found”.

I installed libncurses5 and libtinfo6 and changed to buildozer1.5.0, and the Aidle error did not appear. However, it still stops with many glibc (GNU C Library) related errors.

The function-like macro '__GNUC_PREREQ' is not defined

Ubuntu24.04.1 Conclusion

Buildozer is not available on Ubuntu 24.4 or later. I gave up because there are too many causes to identify any longer.

Tried on Ubuntu 22.04.5

On Ubuntu 22.04.5, Python3.10.12 is installed in [usr/bin].

Python3.12.7 buildozer1.5.1dev0 libtinfo5

When I proceeded without installing libncurses5 and libtinfo5, I got angry with “Aidl not found”.

After installing and updating libncurses5 and libtinfo5, I was able to create an apk successfully. (updated probably to libncurses6)

Python3.11.10 buildozer1.5.0 libtinfo5

I installed and updated libncurses5 and libtinfo5 in the same procedure and succeeded in creating apk. (The updated version was probably libncurses6.) I have not been able to determine if this is the cause of the error.

Ubuntu22.04.5 Conclusion

Buildozer can be installed on Ubuntu 22.04.5. However, if the dependencies are not correct, it will stop with an error.

To verify, if you want to delete the created folder, do the following.

  • .buildozer and .android folders in /home/ < username > /
  • .buildozer folder in the folder where you put the app code

Delete the folder or use the clean command to remove the build information and start over.

buildozer android clean

Android NDK Version

The recommended version of the Android NDK by python-for-android is 25b. The latest version is r27c (LTS version). buildozer.spec has an option to specify the version, so I tried it.

  • r25c: installable
  • r26d and later: stopped with mysterious error

Other Errors

Python code must be “main.py” or it gets angry. there might be a setting item in buildozer.spec.

BUILD FAILURE: No main.py(c) found in your app directory.
file must exist to act as the entry point for your app.
If your app is started by a file with a different name, rename it to main.py or add a
main.py that loads it.

The following may or may not appear: ・・・・ unknown.

# WARNING: Config token app android.sdk is deprecated and ignored, but you set value 34

Summary

Buildozer installation is not easy and is a big problem for beginners; for Ubuntu22 it may be relatively easy to install. The following article will walk you through the installation process, so if you are getting a lot of errors installing Buildozer, please give it a try. Please also refer to the following articles for more information on

Comment

Copied title and URL