Search code examples
pythonkivybuildozer

Could not find a version that satisfies the requirement collections [BUILDOZER]


I am trying to convert my kivy program into apk with buildozer.

I'm doing this via google colab by following this instruction, but having some problems with the requirement here is the module name "collections".

Here is the error:

ERROR: Could not find a version that satisfies the requirement collections (from versions: none)

ERROR: No matching distribution found for collections

I have been looking for this bug the whole day but no result found. Any help would be very appreciated since I need it for my career.

Here is the full traceback and exception given:

Exception in thread background thread for pid 183075:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/sh.py", line 1683, in wrap
    fn(*rgs, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/sh.py", line 2662, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python3.7/dist-packages/sh.py", line 2349, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python3.7/dist-packages/sh.py", line 905, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /bin/bash -c 'venv/bin/pip install -v --target '"'"'/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/armeabi-v7a'"'"' --no-deps -r requirements.txt'

  STDOUT:
Ignoring "sys._home = value" override
Using pip 22.1.2 from /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/venv/lib/python3.8/site-packages/pip (python 3.8)
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting certifi
  Using cached certifi-2022.5.18.1-py3-none-any.whl (155 kB)
ERROR: Could not find a version that satisfies the requirement collections (from versions: none)
ERROR: No matching distribution found for collections


  STDERR:


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 "/content/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1294, in <module>
    main()
  File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 728, in __init__
    getattr(self, command)(args)
  File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 151, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 213, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 622, in build_recipes
    ignore_setup_py=ignore_project_setup_py
  File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 853, in run_pymodules_install
    _env=copy.copy(env))
  File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
  File "/usr/local/lib/python3.7/dist-packages/sh.py", line 953, in next
    self.wait()
  File "/usr/local/lib/python3.7/dist-packages/sh.py", line 879, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python3.7/dist-packages/sh.py", line 905, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /bin/bash -c 'venv/bin/pip install -v --target '"'"'/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/armeabi-v7a'"'"' --no-deps -r requirements.txt'

  STDOUT:
Ignoring "sys._home = value" override
Using pip 22.1.2 from /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/venv/lib/python3.8/site-packages/pip (python 3.8)
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting certifi
  Using cached certifi-2022.5.18.1-py3-none-any.whl (155 kB)
ERROR: Could not find a version that satisfies the requirement collections (from versions: none)
ERROR: No matching distribution found for collections


  STDERR:







# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy,random,datetime,csv,os,tkinter,enum,collections --arch arm64-v8a --arch armeabi-v7a --copy-libs --color=always --storage-dir="/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a" --ndk-api=21 --ignore-setup-py --debug
# ENVIRONMENT:
#     CUDNN_VERSION = '8.0.5.39'
#     PYDEVD_USE_FRAME_EVAL = 'NO'
#     LD_LIBRARY_PATH = '/usr/local/nvidia/lib:/usr/local/nvidia/lib64'
#     CLOUDSDK_PYTHON = 'python3'
#     LANG = 'en_US.UTF-8'
#     ENABLE_DIRECTORYPREFETCHER = '1'
#     HOSTNAME = 'e2779c9274a2'
#     OLDPWD = '/'
#     CLOUDSDK_CONFIG = '/content/.config'
#     USE_AUTH_EPHEM = '1'
#     NVIDIA_VISIBLE_DEVICES = 'all'
#     DATALAB_SETTINGS_OVERRIDES = '{"kernelManagerProxyPort":6000,"kernelManagerProxyHost":"172.28.0.3","jupyterArgs":["--ip=172.28.0.2"],"debugAdapterMultiplexerPath":"/usr/local/bin/dap_multiplexer","enableLsp":true}'
#     ENV = '/root/.bashrc'
#     PAGER = 'cat'
#     NCCL_VERSION = '2.7.8'
#     TF_FORCE_GPU_ALLOW_GROWTH = 'true'
#     JPY_PARENT_PID = '43'
#     NO_GCE_CHECK = 'False'
#     PWD = '/content'
#     HOME = '/root'
#     LAST_FORCED_REBUILD = '20220516'
#     CLICOLOR = '1'
#     DEBIAN_FRONTEND = 'noninteractive'
#     LIBRARY_PATH = '/usr/local/cuda/lib64/stubs'
#     GCE_METADATA_TIMEOUT = '3'
#     GLIBCPP_FORCE_NEW = '1'
#     TBE_CREDS_ADDR = '172.28.0.1:8008'
#     TERM = 'xterm-color'
#     SHELL = '/bin/bash'
#     GCS_READ_CACHE_BLOCK_SIZE_MB = '16'
#     PYTHONWARNINGS = 'ignore:::pip._internal.cli.base_command'
#     MPLBACKEND = 'module://ipykernel.pylab.backend_inline'
#     CUDA_VERSION = '11.1.1'
#     NVIDIA_DRIVER_CAPABILITIES = 'compute,utility'
#     SHLVL = '1'
#     PYTHONPATH = '/env/python'
#     NVIDIA_REQUIRE_CUDA = ('cuda>=11.1 brand=tesla,driver>=418,driver<419 '
 'brand=tesla,driver>=440,driver<441 brand=tesla,driver>=450,driver<451')
#     TBE_EPHEM_CREDS_ADDR = '172.28.0.1:8009'
#     COLAB_GPU = '0'
#     GLIBCXX_FORCE_NEW = '1'
#     PATH = '/root/.buildozer/android/platform/apache-ant-1.9.4/bin:/opt/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tools/node/bin:/tools/google-cloud-sdk/bin'
#     LD_PRELOAD = '/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4'
#     GIT_PAGER = 'cat'
#     _ = '/usr/local/bin/buildozer'
#     PACKAGES_PATH = '/root/.buildozer/android/packages'
#     ANDROIDSDK = '/root/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/root/.buildozer/android/platform/android-ndk-r19b'
#     ANDROIDAPI = '27'
#     ANDROIDMINAPI = '30'
# 
# 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

Solution

  • Okay, so I figure out what is going on now.

    There are 2 problems that I need to solve:

    First: bulldozer only support some GUI modules excluding "Tkinter" which I'm trying to download in the requirements section. Because my program is half in Kivy (supported) and half in Tkinter (not supported) so it's not going to launch even converting into an APK file.

    So you will need somehow replace Tkinter with Kivy or at least delete the Tkinter part in your code. And not to mention it anywhere with Buildozer.

    Second: You don't need to include the "collections" module or other modules that are downloaded with python when you install it, for example: "random", "os", "csv", "collections", etc. Only kivy and modules that you need to do pip install when you use it in IDE should be put in the requirements section (here is spec file) with a specific version (kivy==2.0.0).