Title: Issue with buildozer packaging on Windows 10 WSL environment

28 views
Skip to first unread message

zetspiner

unread,
Jun 1, 2024, 8:09:54 AMJun 1
to Kivy users support

Hi everyone,

I'm encountering an error while trying to package my real-time face recognition model into an Android application using buildozer in a Windows Subsystem for Linux (WSL) environment on Windows 10.

I'm developing the face recognition model using Python 3.7, and I've set up a virtual environment with Kivy also based on Python 3.7.

Here's the error message I'm getting when running buildozer android debug:



(kivy_venv) jhs@DESKTOP:/mnt/c/smu/linear_algebra/kivy/face_recognition_app$ buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /mnt/c/smu/linear_algebra/kivy/kivy_venv/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run ['git', 'config', '--get', 'remote.origin.url']
# Cwd /mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run ['git', 'branch', '-vv']
# Cwd /mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android
* master 957a3e5f [origin/master] Merge pull request #2959 from kivy/release-2024.01.21
# Run ['/mnt/c/smu/linear_algebra/kivy/kivy_venv/bin/python3.7', '-m', 'pip', 'install', '-q', 'appdirs', 'colorama>=0.3.3', 'jinja2', 'sh>=1.10, <2.0; sys_platform!="win32"', 'build', 'toml', 'packaging', 'setuptools']
# Cwd None
# Apache ANT found at /home/jhs/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/jhs/.buildozer/android/platform/android-sdk
# Android NDK found at /home/jhs/.buildozer/android/platform/android-ndk-r25b
# Recommended android's NDK version by p4a is: 25b
# Run ['/mnt/c/smu/linear_algebra/kivy/kivy_venv/bin/python3.7', '-m', 'pythonforandroid.toolchain', 'aab', '-h', '--color=always', '--storage-dir=/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
# Cwd /mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
usage: toolchain.py aab [-h] [--debug] [--color {always,never,auto}]
                        [--sdk-dir SDK_DIR] [--ndk-dir NDK_DIR]
                        [--android-api ANDROID_API]
                        [--ndk-version NDK_VERSION] [--ndk-api NDK_API]
                        [--symlink-bootstrap-files]
                        [--storage-dir STORAGE_DIR] [--arch ARCH]
                        [--dist-name DIST_NAME] [--requirements REQUIREMENTS]
                        [--recipe-blacklist RECIPE_BLACKLIST]
                        [--blacklist-requirements BLACKLIST_REQUIREMENTS]
                        [--bootstrap BOOTSTRAP] [--hook HOOK] [--force-build]
                        [--no-force-build] [--require-perfect-match]
                        [--no-require-perfect-match] [--allow-replace-dist]
                        [--no-allow-replace-dist]
                        [--local-recipes LOCAL_RECIPES]
                        [--activity-class-name ACTIVITY_CLASS_NAME]
                        [--service-class-name SERVICE_CLASS_NAME]
                        [--java-build-tool {auto,ant,gradle}] [--copy-libs]
                        [--no-copy-libs] [--add-asset ASSETS]
                        [--add-resource RESOURCES] [--private PRIVATE]
                        [--use-setup-py] [--ignore-setup-py] [--release]
                        [--with-debug-symbols] [--keystore KEYSTORE]
                        [--signkey SIGNKEY] [--keystorepw KEYSTOREPW]
                        [--signkeypw SIGNKEYPW]

optional arguments:
  -h, --help            show this help message and exit
  --debug               Display debug output and all build info
  --color {always,never,auto}
                        Enable or disable color output (default enabled on
                        tty)
  --sdk-dir SDK_DIR, --sdk_dir SDK_DIR
                        The filepath where the Android SDK is installed
  --ndk-dir NDK_DIR, --ndk_dir NDK_DIR
                        The filepath where the Android NDK is installed
  --android-api ANDROID_API, --android_api ANDROID_API
                        The Android API level to build against defaults to 33
                        if not specified.
  --ndk-version NDK_VERSION, --ndk_version NDK_VERSION
                        DEPRECATED: the NDK version is now found automatically
                        or not at all.
  --ndk-api NDK_API     The Android API level to compile against. This should
                        be your *minimal supported* API, not normally the same
                        as your --android-api. Defaults to min(ANDROID_API,
                        21) if not specified.
  --symlink-bootstrap-files, --ssymlink_bootstrap_files
                        If True, symlinks the bootstrap files creation. This
                        is useful for development only, it could also cause
                        weird problems.
  --storage-dir STORAGE_DIR
                        Primary storage directory for downloads and builds
                        (default: /home/jhs/.local/share/python-for-android)
  --arch ARCH           The archs to build for.
  --dist-name DIST_NAME, --dist_name DIST_NAME
                        The name of the distribution to use or create
  --requirements REQUIREMENTS
                        Dependencies of your app, should be recipe names or
                        Python modules. NOT NECESSARY if you are using Python
                        3 with --use-setup-py
  --recipe-blacklist RECIPE_BLACKLIST
                        Blacklist an internal recipe from use. Allows
                        disabling Python 3 core modules to save size
  --blacklist-requirements BLACKLIST_REQUIREMENTS
                        Blacklist an internal recipe from use. Allows
                        disabling Python 3 core modules to save size
  --bootstrap BOOTSTRAP
                        The bootstrap to build with. Leave unset to choose
                        automatically.
  --hook HOOK           Filename to a module that contains python-for-android
                        hooks
  --local-recipes LOCAL_RECIPES, --local_recipes LOCAL_RECIPES
                        Directory to look for local recipes
  --activity-class-name ACTIVITY_CLASS_NAME
                        The full java class name of the main activity
  --service-class-name SERVICE_CLASS_NAME
                        Full java package name of the PythonService class
  --java-build-tool {auto,ant,gradle}
                        The java build tool to use when packaging the APK,
                        defaults to automatically selecting an appropriate
                        tool.
  --add-asset ASSETS    Put this in the assets folder in the apk.
  --add-resource RESOURCES
                        Put this in the res folder in the apk.
  --private PRIVATE     the directory with the app source code files
                        (containing your main.py entrypoint)
  --use-setup-py        Process the setup.py of a project if present.
                        (Experimental!
  --ignore-setup-py     Don't run the setup.py of a project if present. This
                        may be required if the setup.py is not designed to
                        work inside p4a (e.g. by installing dependencies that
                        won't work or aren't desired on Android
  --release             Build your app as a non-debug release build. (Disables
                        gdb debugging among other things)
  --with-debug-symbols  Will keep debug symbols from `.so` files.
  --keystore KEYSTORE   Keystore for JAR signing key, will use jarsigner
                        default if not specified (release build only)
  --signkey SIGNKEY     Key alias to sign PARSER_APK. with (release build
                        only)
  --keystorepw KEYSTOREPW
                        Password for keystore
  --signkeypw SIGNKEYPW
                        Password for key alias

  Whether to force compilation of a new distribution

  --force-build
  --no-force-build      (this is the default)
  --require-perfect-match
  --no-require-perfect-match
                        (this is the default)
  --allow-replace-dist  (this is the default)
  --no-allow-replace-dist
  --copy-libs
  --no-copy-libs        (this is the default)
# Check application requirements
# Compile platform
# Run ['/mnt/c/smu/linear_algebra/kivy/kivy_venv/bin/python3.7', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=facerecoapp', '--bootstrap=sdl2', '--requirements=python3,kivy,opencv-python-headless,face_recognition,scikit-learn,numpy,pillow', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
# Cwd /mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
[INFO]:    Will compile for the following archs: arm64-v8a, armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI: 31
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1256, in <module>
    main()
  File "/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 685, in __init__
    getattr(self, command)(args)
  File "/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 97, in wrapper_func
    user_ndk_api=self.ndk_api)
  File "/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 273, in prepare_build_environment
    apis = get_available_apis(self.sdk_dir)
  File "/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 48, in get_available_apis
    targets = get_targets(sdk_dir)
  File "/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 31, in get_targets
    avdmanager = sh.Command(join(sdk_dir, 'cmdline-tools', 'latest', 'bin', 'avdmanager'))
  File "/mnt/c/smu/linear_algebra/kivy/kivy_venv/lib/python3.7/site-packages/sh.py", line 1310, in __init__
    raise CommandNotFound(path)
sh.CommandNotFound: /home/jhs/.buildozer/android/platform/android-sdk/cmdline-tools/latest/bin/avdmanager
# Command failed: ['/mnt/c/smu/linear_algebra/kivy/kivy_venv/bin/python3.7', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=facerecoapp', '--bootstrap=sdl2', '--requirements=python3,kivy,opencv-python-headless,face_recognition,scikit-learn,numpy,pillow', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
# ENVIRONMENT:
#     SHELL = '/bin/bash'
#     WSL2_GUI_APPS_ENABLED = '1'
#     WSL_DISTRO_NAME = 'Ubuntu-22.04'
#     JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64'
#     NAME = 'DESKTOP-J4OTQKP'
#     PWD = '/mnt/c/smu/linear_algebra/kivy/face_recognition_app'
#     LOGNAME = 'jhs'
#     HOME = '/home/jhs'
#     LANG = 'C.UTF-8'
#     WSL_INTEROP = '/run/WSL/382_interop'
#     LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
#     VIRTUAL_ENV = '/mnt/c/smu/linear_algebra/kivy/kivy_venv'
#     WAYLAND_DISPLAY = 'wayland-0'
#     LESSCLOSE = '/usr/bin/lesspipe %s %s'
#     ANDROID_HOME = '/home/jhs/.buildozer/android/platform/android-sdk'
#     TERM = 'xterm-256color'
#     LESSOPEN = '| /usr/bin/lesspipe %s'
#     USER = 'jhs'
#     DISPLAY = ':0'
#     SHLVL = '1'
#     ANDROID_SDK_ROOT = '/home/jhs/.buildozer/android/platform/android-sdk'
#     XDG_RUNTIME_DIR = '/run/user/1000/'
#     PS1 = ('(kivy_venv) \\[\\e]0;\\u@\\h: '
 '\\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ ')
#     WSLENV = ''
#     XDG_DATA_DIRS = '/usr/local/share:/usr/share:/var/lib/snapd/desktop'
#     PATH = ('/home/jhs/.buildozer/android/platform/apache-ant-1.9.4/bin:/mnt/c/smu/linear_algebra/kivy/kivy_venv/bin:/home/jhs/.buildozer/android/platform/android-sdk/platform-tools:/home/jhs/.buildozer/android/platform/android-sdk/cmdline-tools/latest/bin:/usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program '
 'Files/WindowsApps/CanonicalGroupLimited.Ubuntu22.04LTS_2204.3.63.0_x64__79rhkp1fndgsc:/mnt/c/Program '
 'Files/Common Files/Oracle/Java/javapath:/mnt/c/Program Files (x86)/NVIDIA '
 'Corporation/PhysX/Common:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program '
 'Files/Bandizip/:/mnt/c/Program Files/Common Files/Autodesk '
 'Shared/:/mnt/c/Program Files/Microsoft SQL '
 'Server/120/Tools/Binn/:/mnt/c/Program Files/dotnet/:/mnt/c/Program '
 'Files/Git/cmd:/mnt/c/Program '
 'Files/nodejs/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Users/J-Fam/AppData/Roaming/Python/Python311:/mnt/c/Users/J-Fam/AppData/Roaming/Python/Python311/Scripts:/mnt/c/Users/J-Fam/AppData/Local/Programs/Python/Python311:/mnt/c/Users/J-Fam/AppData/Local/Programs/Python/Python311/Scripts:/mnt/c/Python311:/mnt/c/Python311/Scripts:/mnt/c/smu/linear_algebra/android_app/cmake-3.29.3-windows-x86_64/bin:/mnt/c/Users/J-Fam/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program '
 'Files/JetBrains/PyCharm Community Edition '
 '2022.3.2/bin:/mnt/c/Users/J-Fam/AppData/Local/Programs/Microsoft VS '
 'Code/bin:/mnt/c/Program '
 'Files/heroku/bin:/mnt/c/Users/J-Fam/AppData/Roaming/npm:/snap/bin')
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
#     HOSTTYPE = 'x86_64'
#     PULSE_SERVER = 'unix:/mnt/wslg/PulseServer'
#     OLDPWD = '/mnt/c/smu/linear_algebra/kivy'
#     _ = '/mnt/c/smu/linear_algebra/kivy/kivy_venv/bin/buildozer'
#     PACKAGES_PATH = '/home/jhs/.buildozer/android/packages'
#     ANDROIDSDK = '/home/jhs/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/jhs/.buildozer/android/platform/android-ndk-r25b'
#     ANDROIDAPI = '31'
#     ANDROIDMINAPI = '21'
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2



I've tried reinstalling the Android SDK and ensuring that the necessary files are present in the specified paths. However, the issue persists.

Has anyone else encountered a similar problem or have any suggestions on how to troubleshoot this? Any help would be greatly appreciated

Thanks in advance!

Juan Sanchez

unread,
Jun 1, 2024, 3:56:21 PMJun 1
to kivy-...@googlegroups.com
Hello,

The ".buildozer" name on the windows share may be a problem.

# Command failed: ['/mnt/c/smu/linear_algebra/kivy/kivy_venv/bin/python3.7', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=facerecoapp', '--bootstrap=sdl2', '--requirements=python3,kivy,opencv-python-headless,face_recognition,scikit-learn,numpy,pillow', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']

/mnt/c/smu/linear_algebra/kivy/face_recognition_app/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a

Try to avoid using the windows file system "/mnt/c" for linux development.  The windows/linux translation is slow, and there are some limitations in the filenames that windows can be used.

Instead use your wsl home directory or any other linux formatted directory in your installation for development.

That may or may not help the problem.

Regards,

Juan

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/d55ddf13-7318-443a-9ca3-fdc949684045n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages