ImportError: cannot import name 'main'
See original GitHub issueBuild 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Error after upgrading pip: cannot import name 'main'
Whenever I am trying to install any package using pip, I am getting this import error: guru@ ...
Read more >[SOLVED] Error after upgrading pip: cannot import name 'main'
This error mostly occurs when you have accidentally upgraded the pip in our system. · It appears when pip and unpack_url are used...
Read more >ImportError cannot import name main in pip - Edureka
Hi Guys, I am getting this below error, when I am trying to install numpy in my system. $ pip3 ... import name...
Read more >How to solve ImportError: cannot import name 'main'
When I upgrade pip3 by typing sudo pip3 install -U pip and use the upgraded one, I get an error message ' ImportError:...
Read more >[Solved] pip Import Error: cannot import name main
I had this error report once a while, it was happened when I upgrade my pip. Simply speaking, this problem usually occurs when...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @pasteurjr, are you compiling with buildozer’s docker image or by your own installation ? If you build with docker please pull the latest image
Then recreate your buildozer’s container If it’s your own installation, please update pip and virtual env
If you have both python3 and python2 installed, be sure to upgrade python3 environment with
Hope this will help you !
When I’m building Kivy project into android app, I meet such problem: —————————————————————— [INFO]: PYTHON PACKAGE/PROJECT INSTALL STAGE [INFO]: The requirements(certifi) 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. —————————————————————— System information:
Ubuntu18.04.4LTS Python3.6.9(system) pip3 list: pip(20.1) wheel(0.30.0) cython(0.29.17) certifi(2018.1.18) buildozer(1.0.1.dev0)
Plz help me