2

I'm trying to develop an android app with kivy+scrapy(or mechanize) using buildozer. When I add scrapy/mechanize in required field in buildozer.spec file and run buildozer android debug, pip install fails with the error below.

The android sdk and ndk looks like they've been installed successfully with buildozer, and I also tried installing gcc-arm-linux-androideabi, but didn't help.

Is there anything else I can do to fix this issue?

kivy@kivy-VirtualBox:~/kiva$ buildozer -v android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian `dpkg' package management program version 1.17.5 (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 /usr/local/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
# Install platform
# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/.buildozer/android/platform/android-sdk-21
# Android NDK found at /home/kivy/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Run './distribute.sh -l'
# Cwd /home/kivy/kiva/.buildozer/android/platform/python-for-android
Available modules: android apsw audiostream bidi boost cherrypy c_igraph cprotobuf cymunk django docutils ecdsa enum34 evdev ffmpeg ffmpeg2 ffpyplayer freetype gevent greenlet harfbuzz hostpython igraph jpeg kivent_core kivent_cymunk kivy leveldb libevent libpq libsodium libswift libtorrent libxml2 libxslt libyaml lxml m2crypto midistream msgpack mysql_connector netifaces numpy opencv openssl paramiko pil plyer plyvel png polygon protobuf psutil psycopg2 pyasn1 pycrypto pygame pyjnius pylibpd pyopenssl pyparsing pyqrcode python pyyaml sdl setuptools six sqlalchemy sqlite3 storm swift thrift twisted txws wokkel zeroconf zope
# Remove directory and subdirectory /home/kivy/kiva/.buildozer/applibs
# Create directory /home/kivy/kiva/.buildozer/applibs
# Run 'bash -c "source venv/bin/activate && env"'
# Cwd /home/kivy/kiva/.buildozer
LC_PAPER=fr_FR.UTF-8
XDG_VTNR=7
LC_ADDRESS=fr_FR.UTF-8
XDG_SESSION_ID=c1
CLUTTER_IM_MODULE=xim
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/kivy
SELINUX_INIT=YES
SAL_USE_VCLPLUGIN=gtk
LC_MONETARY=fr_FR.UTF-8
SESSION=Lubuntu
GPG_AGENT_INFO=/run/user/1000/keyring-r63Pyx/gpg:0:1
SHELL=/bin/bash
XDG_MENU_PREFIX=lxde-
TERM=screen
LC_NUMERIC=fr_FR.UTF-8
UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1196
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-r63Pyx
USER=kivy
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: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:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=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:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=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:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=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:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
LC_TELEPHONE=fr_FR.UTF-8
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
TERMCAP=SC|screen|VT 100/ANSI X3.64 virtual terminal:\
        :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
        :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
        :do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
        :le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
        :li#42:co#186:am:xn:xv:LP:sr=\EM:al=\E[L:AL=\E[%dL:\
        :cs=\E[%i%d;%dr:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\
        :im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:ks=\E[?1h\E=:\
        :ke=\E[?1l\E>:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
        :ti=\E[?1049h:te=\E[?1049l:us=\E[4m:ue=\E[24m:so=\E[3m:\
        :se=\E[23m:mb=\E[5m:md=\E[1m:mr=\E[7m:me=\E[m:ms:\
        :Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\
        :vb=\Eg:G0:as=\E(0:ae=\E(B:\   
        :ac=\140\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\
        :po=\E[5i:pf=\E[4i:Z0=\E[?3h:Z1=\E[?3l:Km=\E[M:\
        :k0=\E[10~:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:\
        :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\
        :F1=\E[23~:F2=\E[24~:F3=\E[1;2P:F4=\E[1;2Q:F5=\E[1;2R:\
        :F6=\E[1;2S:F7=\E[15;2~:F8=\E[17;2~:F9=\E[18;2~:\
        :FA=\E[19;2~:kb=:K2=\EOE:kB=\E[Z:kF=\E[1;2B:kR=\E[1;2A:\
        :*4=\E[3;2~:*7=\E[1;2F:#2=\E[1;2H:#3=\E[2;2~:#4=\E[1;2D:\
        :%c=\E[6;2~:%e=\E[5;2~:%i=\E[1;2C:kh=\E[1~:@1=\E[1~:\
        :kH=\E[4~:@7=\E[4~:kN=\E[6~:kP=\E[5~:kI=\E[2~:kD=\E[3~:\
        :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:km:
SSH_AUTH_SOCK=/run/user/1000/keyring-r63Pyx/ssh
DEFAULTS_PATH=/usr/share/gconf/Lubuntu.default.path
VIRTUAL_ENV=/home/kivy/kiva/.buildozer/venv
XDG_CONFIG_DIRS=/etc/xdg/lubuntu:/etc/xdg/xdg-Lubuntu:/usr/share/upstart/xdg:/etc/xdg
PATH=/home/kivy/kiva/.buildozer/venv/bin:/home/kivy/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/kivy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
DESKTOP_SESSION=Lubuntu
STY=25597.kivy
QT_IM_MODULE=xim
ANDROIDAPI=14
LC_IDENTIFICATION=fr_FR.UTF-8
JOB=dbus
PWD=/home/kivy/kiva/.buildozer
XMODIFIERS=@im=ibus
LANG=en_US.UTF-8
GNOME_KEYRING_PID=1405
GDM_LANG=en_US
MANDATORY_PATH=/usr/share/gconf/Lubuntu.mandatory.path
LC_MEASUREMENT=fr_FR.UTF-8
ANDROIDNDK=/home/kivy/.buildozer/android/platform/android-ndk-r9c
IM_CONFIG_PHASE=1
PS1=(venv)
GDMSESSION=Lubuntu
_LXSESSION_PID=1444
PACKAGES_PATH=/home/kivy/.buildozer/android/packages
SESSIONTYPE=lxsession
HOME=/home/kivy
SHLVL=3
XDG_SEAT=seat0
XDG_CONFIG_HOME=/home/kivy/.config
LANGUAGE=en_US
UPSTART_INSTANCE=
UPSTART_EVENTS=started xsession
ANDROIDSDK=/home/kivy/.buildozer/android/platform/android-sdk-21
LOGNAME=kivy
WINDOW=0
XDG_DATA_DIRS=/etc/xdg/lubuntu:/usr/local/share:/usr/share:/usr/share/gdm:/var/lib/menu-xdg:/usr/share/Lubuntu:/usr/local/share/:/usr/share/
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-6RdFOeFlCI
QT4_IM_MODULE=xim
LESSOPEN=| /usr/bin/lesspipe %s
ANDROIDNDKVER=r9c
UPSTART_JOB=lxsession
INSTANCE=
TEXTDOMAIN=im-config
DISPLAY=:0
XDG_RUNTIME_DIR=/run/user/1000
XDG_CURRENT_DESKTOP=LXDE
GTK_IM_MODULE=xim
LESSCLOSE=/usr/bin/lesspipe %s %s
LC_TIME=fr_FR.UTF-8
TEXTDOMAINDIR=/usr/share/locale/
LC_NAME=fr_FR.UTF-8
XAUTHORITY=/home/kivy/.Xauthority
_=/usr/bin/env
# Install distribute
# Run 'curl http://python-distribute.org/distribute_setup.py | venv/bin/python'
# Cwd /home/kivy/kiva/.buildozer
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
# Install requirement mechanize in virtualenv
# Run 'pip install --download-cache=/home/kivy/.buildozer/cache --target=/home/kivy/kiva/.buildozer/applibs mechanize'
# Cwd /home/kivy/kiva/.buildozer
Downloading/unpacking mechanize
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fm%2Fmechanize%2Fmechanize-0.2.5.tar.gz
  Running setup.py (path:/home/kivy/kiva/.buildozer/venv/build/mechanize/setup.py) egg_info for package mechanize

Installing collected packages: mechanize
  Running setup.py install for mechanize

Successfully installed mechanize
Cleaning up...
# Install distribute
# Run 'curl http://python-distribute.org/distribute_setup.py | venv/bin/python'
# Cwd /home/kivy/kiva/.buildozer
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
# Install requirement pyOpenSSL in virtualenv
# Run 'pip install --download-cache=/home/kivy/.buildozer/cache --target=/home/kivy/kiva/.buildozer/applibs pyOpenSSL'
# Cwd /home/kivy/kiva/.buildozer
Downloading/unpacking pyOpenSSL
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fpy2.py3%2Fp%2FpyOpenSSL%2FpyOpenSSL-0.15.1-py2.py3-none-any.whl
Downloading/unpacking six>=1.5.2 (from pyOpenSSL)
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2F3.3%2Fs%2Fsix%2Fsix-1.9.0-py2.py3-none-any.whl
Downloading/unpacking cryptography>=0.7 (from pyOpenSSL)
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fc%2Fcryptography%2Fcryptography-0.9.3.tar.gz
  Running setup.py (path:/home/kivy/kiva/.buildozer/venv/build/cryptography/setup.py) egg_info for package cryptography

    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
Downloading/unpacking idna (from cryptography>=0.7->pyOpenSSL)
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2F2.7%2Fi%2Fidna%2Fidna-2.0-py2.py3-none-any.whl
Downloading/unpacking pyasn1 (from cryptography>=0.7->pyOpenSSL)
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpyasn1%2Fpyasn1-0.1.8.tar.gz
  Running setup.py (path:/home/kivy/kiva/.buildozer/venv/build/pyasn1/setup.py) egg_info for package pyasn1

Downloading/unpacking setuptools (from cryptography>=0.7->pyOpenSSL)
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2F3.4%2Fs%2Fsetuptools%2Fsetuptools-18.1-py2.py3-none-any.whl
Downloading/unpacking enum34 (from cryptography>=0.7->pyOpenSSL)
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fe%2Fenum34%2Fenum34-1.0.4.tar.gz
  Running setup.py (path:/home/kivy/kiva/.buildozer/venv/build/enum34/setup.py) egg_info for package enum34

Downloading/unpacking ipaddress (from cryptography>=0.7->pyOpenSSL)
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2F2.7%2Fi%2Fipaddress%2Fipaddress-1.0.14-py27-none-any.whl
Downloading/unpacking cffi>=0.8 (from cryptography>=0.7->pyOpenSSL)
  Using download cache from /home/kivy/.buildozer/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fc%2Fcffi%2Fcffi-1.1.2.tar.gz
  Running setup.py (path:/home/kivy/kiva/.buildozer/venv/build/cffi/setup.py) egg_info for package cffi

        No working compiler found, or bogus compiler options
        passed to the compiler from Python's distutils module.
        See the error messages above.  
        (If they are about -mno-fused-madd and you are on OS/X 10.8,
        see http://stackoverflow.com/questions/22313407/ .)
    Complete output from command python setup.py egg_info:


    No working compiler found, or bogus compiler options

    passed to the compiler from Python's distutils module.

    See the error messages above.

    (If they are about -mno-fused-madd and you are on OS/X 10.8,

    see http://stackoverflow.com/questions/22313407/ .)

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/kivy/kiva/.buildozer/venv/build/cffi
Storing debug log for failure in /tmp/tmpdq6xPq
# Command failed: pip install --download-cache=/home/kivy/.buildozer/cache --target=/home/kivy/kiva/.buildozer/applibs pyOpenSSL
# 
# 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

Here's a recipe that I added for cffi. cffi does get compiled when I add requirements=cffi,kivy but when I add the requirements=scrapy,kivy the build fails with the error above. I added logging in the recipe.sh for cffi, but the log doesn't show up, so I'm assuming that recipe is not being executed at all. I also noticed that cffi is built in virtualenv. Could this be relevant?

#!/bin/bash
VERSION_cffi=${VERSION_cffi:-1.1.2}
DEPS_cffi=(python setuptools)
URL_cffi=http://pypi.python.org/packages/source/c/cffi/cffi-$VERSION_cffi.tar.gz
MD5_cffi=
BUILD_cffi=$BUILD_PATH/cffi/$(get_directory $URL_cffi)
RECIPE_cffi=$RECIPES_PATH/cffi

function prebuild_cffi() {
    true
}

function build_cffi() {
    push_arm
        cd $BUILD_python/Modules/_ctypes/libffi/
        try ./configure --host=arm
        try make
        cd $BUILD_cffi
        #export CC="$CC -I$BUILD_python/build/temp.linux-x86_64-2.7/libffi/include/"                                                                    
        export PYTHONPATH="$BUILD_hostpython/Lib/site-packages/:$BUILD_hostpython/build/lib.linux-x86_64-2.7/"
        try $HOSTPYTHON setup.py build_ext -v -L$BUILD_python/Modules/_ctypes/libffi/.libs/ -I$BUILD_python/build/temp.linux-x86_64-2.7/libffi/include/
        try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages
    pop_arm
}

function postbuild_cffi() {
        true
}
  • Can you post the log without cutting the beginning off? – inclement Aug 08 '15 at 18:10
  • I guess you need a cffi recipe though, and if so to include it in the recipe requirements. The problem is likely that it finds no compiler because python-for-android is trying to install it with pip, but it can't currently do this automatically for compiled recipes because they need to be told to use the android ndk compiler. – inclement Aug 08 '15 at 18:12
  • Added the whole log. – user2261173 Aug 10 '15 at 01:58
  • http://python-for-android.readthedocs.org/en/latest/usage/ Is this the receipe that you're refererring to? Would adding a cffi recipe to python-for-android solve this issue? – user2261173 Aug 10 '15 at 02:02
  • I've written a recipe for cffi, but when I include scrapy in the requirements, the recipe seem to get ignored. Is there some extra setting that needs to be written? – user2261173 Aug 11 '15 at 17:01
  • The issue seem to be cryptography which depends on cffi. When I add cryptography in the requirements, recipes.sh doesn't get run at all. – user2261173 Aug 11 '15 at 17:14
  • Can you post your recipe source in your question? – inclement Aug 11 '15 at 17:26
  • Added the recipe for cffi in the question. – user2261173 Aug 12 '15 at 05:32

0 Answers0