Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing _ctypes module #955

Closed
NicolaM94 opened this issue Aug 27, 2019 · 3 comments
Closed

Missing _ctypes module #955

NicolaM94 opened this issue Aug 27, 2019 · 3 comments

Comments

@NicolaM94
Copy link

NicolaM94 commented Aug 27, 2019

Hello guys!

As the title says, I get this error while trying to build for android a Kivy application. I tried both pushing directly to android and packing a debug apk but both didn't work.
I looked over and I found that installing libff1-dev could solve the problem, but I already have it installed and updated so I can't find where the problem is.

Thanks in advance for the help!

Exception in thread background thread for pid 11602:                                                                                                                                                              
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/sh-1.12.14-py3.7.egg/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/sh-1.12.14-py3.7.egg/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python3.7/dist-packages/sh-1.12.14-py3.7.egg/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python3.7/dist-packages/sh-1.12.14-py3.7.egg/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/native-build/python setup.py install -O2 --root=/home/nicola/Desktop/try/.buildozer/android/platform/build/build/python-installs/try --install-lib=.

  STDOUT:
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    import setuptools
  File "/home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 20, in <module>
    from setuptools.dist import Distribution, Feature
  File "/home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 36, in <module>
    from setuptools import windows_support
  File "/home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
    import ctypes
  File "/home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'


  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 "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1192, in <module>
    main()
  File "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 668, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 153, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 206, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 577, in build_recipes
    recipe.build_arch(arch)
  File "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 844, in build_arch
    self.install_python_package(arch)
  File "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 863, in install_python_package
    _env=hpenv, *self.setup_extra_args)
  File "/home/nicola/Desktop/try/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 180, in shprint
    for line in output:
  File "/usr/local/lib/python3.7/dist-packages/sh-1.12.14-py3.7.egg/sh.py", line 863, in next
    self.wait()
  File "/usr/local/lib/python3.7/dist-packages/sh-1.12.14-py3.7.egg/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python3.7/dist-packages/sh-1.12.14-py3.7.egg/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/native-build/python setup.py install -O2 --root=/home/nicola/Desktop/try/.buildozer/android/platform/build/build/python-installs/try --install-lib=.

  STDOUT:
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    import setuptools
  File "/home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 20, in <module>
    from setuptools.dist import Distribution, Feature
  File "/home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 36, in <module>
    from setuptools import windows_support
  File "/home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
    import ctypes
  File "/home/nicola/Desktop/try/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'


  STDERR:

# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=try --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/nicola/Desktop/try/.buildozer/android/platform/build" --ndk-api=21
# ENVIRONMENT:
#     SHELL = '/bin/bash'
#     SESSION_MANAGER = 'local/nicolaDesktop:@/tmp/.ICE-unix/1367,unix/nicolaDesktop:/tmp/.ICE-unix/1367'
#     QT_ACCESSIBILITY = '1'
#     COLORTERM = 'truecolor'
#     XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg'
#     XDG_MENU_PREFIX = 'gnome-'
#     GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
#     GTK_IM_MODULE = 'ibus'
#     LANGUAGE = 'en'
#     QT4_IM_MODULE = 'xim'
#     LC_ADDRESS = 'it_IT.UTF-8'
#     GNOME_SHELL_SESSION_MODE = 'ubuntu'
#     LC_NAME = 'it_IT.UTF-8'
#     SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
#     XMODIFIERS = '@im=ibus'
#     DESKTOP_SESSION = 'ubuntu'
#     LC_MONETARY = 'it_IT.UTF-8'
#     SSH_AGENT_PID = '1765'
#     GTK_MODULES = 'gail:atk-bridge'
#     XDG_SEAT = 'seat0'
#     PWD = '/home/nicola/Desktop/try'
#     LOGNAME = 'nicola'
#     XDG_SESSION_DESKTOP = 'ubuntu'
#     XDG_SESSION_TYPE = 'x11'
#     GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
#     XAUTHORITY = '/run/user/1000/gdm/Xauthority'
#     GJS_DEBUG_TOPICS = 'JS ERROR;JS LOG'
#     WINDOWPATH = '2'
#     HOME = '/home/nicola'
#     USERNAME = 'nicola'
#     IM_CONFIG_PHASE = '2'
#     LC_PAPER = 'it_IT.UTF-8'
#     LANG = 'en_US.UTF-8'
#     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:*.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:'
#     XDG_CURRENT_DESKTOP = 'ubuntu:GNOME'
#     VTE_VERSION = '5602'
#     GNOME_TERMINAL_SCREEN = '/org/gnome/Terminal/screen/d16055d7_7099_48b6_a5e9_bb2c885dec96'
#     CLUTTER_IM_MODULE = 'xim'
#     GJS_DEBUG_OUTPUT = 'stderr'
#     LESSCLOSE = '/usr/bin/lesspipe %s %s'
#     XDG_SESSION_CLASS = 'user'
#     TERM = 'xterm-256color'
#     LC_IDENTIFICATION = 'it_IT.UTF-8'
#     LESSOPEN = '| /usr/bin/lesspipe %s'
#     USER = 'nicola'
#     GNOME_TERMINAL_SERVICE = ':1.124'
#     DISPLAY = ':0'
#     SHLVL = '1'
#     LC_TELEPHONE = 'it_IT.UTF-8'
#     QT_IM_MODULE = 'xim'
#     LC_MEASUREMENT = 'it_IT.UTF-8'
#     XDG_VTNR = '2'
#     XDG_SESSION_ID = '1'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     LC_TIME = 'it_IT.UTF-8'
#     XDG_DATA_DIRS = '/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop'
#     PATH = '/home/nicola/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/nicola/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
#     GDMSESSION = 'ubuntu'
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
#     LC_NUMERIC = 'it_IT.UTF-8'
#     OLDPWD = '/home/nicola'
#     _ = '/usr/local/bin/buildozer'
#     PACKAGES_PATH = '/home/nicola/.buildozer/android/packages'
#     ANDROIDSDK = '/home/nicola/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/nicola/.buildozer/android/platform/android-ndk-r17c'
#     ANDROIDAPI = '27'
#     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

@AndreMiras
Copy link
Member

Same as #963 (comment)

@KyrillosAkram
Copy link

I had the same issue until i cleaned buildozer by this command
buildozer android clean
then renamed the .py file to main.py
check this https://stackoverflow.com/questions/54621830/errors-packaging-app-for-android-using-ubuntu-and-buildozer
make sure that libffi in requirments not libffi-dev

please tell if this solved the problem

@NicolaM94
Copy link
Author

I had the same issue until i cleaned buildozer by this command
buildozer android clean
then renamed the .py file to main.py
check this https://stackoverflow.com/questions/54621830/errors-packaging-app-for-android-using-ubuntu-and-buildozer
make sure that libffi in requirments not libffi-dev

please tell if this solved the problem

Ok that changed something, but still no actual solution. My error just moved to another exception, that is:
`

Check configuration tokens

Ensure build layout

Check configuration tokens

Read available permissions from api-versions.xml

Preparing build

Check requirements for android

Run 'dpkg --version'

Cwd None

Debian 'dpkg' package management program version 1.19.7 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.

Search for Git (git)

-> found at /usr/bin/git

Search for Cython (cython)

-> found at /home/nicola/.local/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 '/usr/bin/python3 -m pip install -q --user 'appdirs' 'colorama>=0.3.3' 'jinja2' 'six' 'enum34; python_version<"3.4"' 'sh>=1.10; sys_platform!="nt"' 'pep517' 'pytoml' 'virtualenv''

Cwd None

Apache ANT found at /home/nicola/.buildozer/android/platform/apache-ant-1.9.4

Android SDK found at /home/nicola/.buildozer/android/platform/android-sdk

Android NDK found at /home/nicola/.buildozer/android/platform/android-ndk-r17c

Read available permissions from api-versions.xml

Check application requirements

Check garden requirements

Compile platform

Run '/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/nicola/Desktop/RunUpWords/.buildozer/android/platform/build" --ndk-api=21'

Cwd /home/nicola/Desktop/RunUpWords/.buildozer/android/platform/python-for-android

/home/nicola/Desktop/RunUpWords/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py:85: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
[INFO]: Will compile for the following archs: armeabi-v7a
[INFO]: Found Android API target in $ANDROIDAPI: 27
[INFO]: Available Android APIs are ()
[ERROR]: Build failed: Requested API target 27 is not available, install it with the SDK android tool.

Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/nicola/Desktop/RunUpWords/.buildozer/android/platform/build" --ndk-api=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

`
So now I think it's a SDK problem somehow. I think I will just clean everything and reinstall buildozer packages and dependencies at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants