Skip to content

ImportError: cannot import name 'main' #1052

@brvier

Description

@brvier

Build failed while trying to install python dependancies :

[INFO]:    *** PYTHON PACKAGE / PROJECT INSTALL STAGE ***
[INFO]:    The requirements (certifi, gpxpy, oscpy, plyer) don't have recipes, attempting to install them with pip
[INFO]:    If this fails, it may mean that the module has compiled components and needs a recipe.
[INFO]:    -> directory context /home/user/hostcwd/.buildozer/android/platform/build-arm64-v8a/build
stty: 'standard input': Inappropriate ioctl for device
[INFO]:    -> running virtualenv --python=python3 venv
Exception in thread background thread for pid 38291:                                               
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/user/.local/bin/virtualenv --python=python3 venv

  STDOUT:
Traceback (most recent call last):
  File "/home/user/.local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
ImportError: cannot import name 'main'


  STDERR:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1212, in <module>
    main()
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 680, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 154, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 212, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 603, in build_recipes
    ignore_setup_py=ignore_project_setup_py
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 773, in run_pymodules_install
    'venv'
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 863, in next
    self.wait()
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/user/.local/bin/virtualenv --python=python3 venv

  STDOUT:
Traceback (most recent call last):
  File "/home/user/.local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
ImportError: cannot import name 'main'

Versions

  • Python: The one use in the Dockerfile
  • OS: The one use in the Dockerfile
  • Buildozer: master

Description

  • git clone https://github.com/kivy/buildozer
  • cd buildozer
  • docker build --tag=buildozer .
  • mkdir test_buildozer
  • cd test_buildozer
  • docker run --volume "${HOME}/.buildozer":/home/user/.buildozer:Z --volume "${PWD}":/home/user/hostcwd:Z buildozer android debug

Logs

[INFO]:    Postbuilding kivy for arm64-v8a
[INFO]:    # Installing pure Python modules
[INFO]:    *** PYTHON PACKAGE / PROJECT INSTALL STAGE ***
[INFO]:    The requirements (certifi, gpxpy, oscpy, plyer) don't have recipes, attempting to install them with pip
[INFO]:    If this fails, it may mean that the module has compiled components and needs a recipe.
[INFO]:    -> directory context /home/user/hostcwd/.buildozer/android/platform/build-arm64-v8a/build
stty: 'standard input': Inappropriate ioctl for device
[INFO]:    -> running virtualenv --python=python3 venv
Exception in thread background thread for pid 38291:                                               
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/user/.local/bin/virtualenv --python=python3 venv

  STDOUT:
Traceback (most recent call last):
  File "/home/user/.local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
ImportError: cannot import name 'main'


  STDERR:


Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1212, in <module>
    main()
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 680, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 154, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 212, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 603, in build_recipes
    ignore_setup_py=ignore_project_setup_py
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 773, in run_pymodules_install
    'venv'
  File "/home/user/hostcwd/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
    for line in output:
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 863, in next
    self.wait()
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/user/.local/bin/virtualenv --python=python3 venv

  STDOUT:
Traceback (most recent call last):
  File "/home/user/.local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
ImportError: cannot import name 'main'


  STDERR:

# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=ohmy --bootstrap=sdl2 --requirements=plyer,kivy,requests,openssl,certifi,gpxpy,oscpy,android --arch arm64-v8a --copy-libs --color=always --storage-dir="/home/user/hostcwd/.buildozer/android/platform/build-arm64-v8a" --ndk-api=26
# ENVIRONMENT:
#     PATH = '/home/user/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
#     HOSTNAME = '5755fc8b672b'
#     P4A_RELEASE_KEYSTORE = '/home/user/hostcwd/google_keystore.jks'
#     P4A_RELEASE_KEYSTORE_PASSWD = 'xxxx'
#     P4A_RELEASE_KEYALIAS_PASSWD = 'xxxx'
#     P4A_RELEASE_KEYALIAS = 'ohmy'
#     USER = 'user'
#     HOME_DIR = '/home/user'
#     WORK_DIR = '/home/user/hostcwd'
#     SRC_DIR = '/home/user/src'
#     LANG = 'en_US.UTF-8'
#     LANGUAGE = 'en_US.UTF-8'
#     LC_ALL = 'en_US.UTF-8'
#     HOME = '/home/user'
#     PACKAGES_PATH = '/home/user/.buildozer/android/packages'
#     ANDROIDSDK = '/home/user/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/user/.buildozer/android/platform/android-ndk-r19b'
#     ANDROIDAPI = '29'
#     ANDROIDMINAPI = '26'
# 
# 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions