0
votes

I am writing an application for android, where i am using SpeachRecognition library to translate speech into text using Google API. My program works fine with a kivy GUI on ubuntu 16.04 python 3.5, so how can i build this app using buildozer ? what should the requirements be ? I have modified the requirements in buildozer.spec to become : " requirements = kivy , hostpython2 , SpeechRecognition , pyaudio " , but this raise the following error : " Failed building wheel for pyaudio ".

Edit : ( part of the output of command "Buildozer android debug")

[INFO]: # Installing pure Python modules

[INFO]: The requirements (SpeechRecognition, pyaudio) 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/proctronics/Desktop/test/.buildozer/android/platform/build/build

[INFO]: -> running virtualenv --python=python2.7 venv

objs_paths are ['/home/proctronics/Desktop/test/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python2/collated_objects']

Copying libraries

[INFO]: Creating a requirements.txt file for the Python modules

[INFO]: Installing Python modules with pip

[INFO]: If this fails with a message about /bin/false, this probably means the package cannot be installed with pip as it needs a compilation recipe.

[INFO]: -> running bash -c source venv/bin/activate && env CC=/bin/false CXX=/bin/false PYTHONPATH=/home/proctronics/Desktop/test/.b...(and 259 more)

working: Exception in thread background thread for pid 3095:n/python2.7 -u -c "import setupt...(and 509 more)

Traceback (most recent call last):

File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner

self.run()

File "/usr/lib/python2.7/threading.py", line 754, in run

self.__target(*self.__args, **self.__kwargs)

File "/home/proctronics/.local/lib/python2.7/site-packages/sh.py", line 1540, in wrap

fn(*args, **kwargs)

File "/home/proctronics/.local/lib/python2.7/site-packages/sh.py", line 2459, in background_thread

handle_exit_code(exit_code)

File "/home/proctronics/.local/lib/python2.7/site-packages/sh.py", line 2157, in fn

return self.command.handle_command_exit_code(exit_code)

File "/home/proctronics/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code

raise exc

ErrorReturnCode_1:

RAN: /bin/bash -c source venv/bin/activate && env CC=/bin/false CXX=/bin/false PYTHONPATH=/home/proctronics/Desktop/test/.buildozer/android/platform/build/build/python-installs/blue/lib/python2.7/site-packages pip install --target '/home/proctronics/Desktop/test/.buildozer/android/platform/build/build/python-installs/blue/lib/python2.7/site-packages' --no-deps -r requirements.txt

STDOUT:

Collecting SpeechRecognition (from -r requirements.txt (line 1))

Using cached SpeechRecognition-3.7.1-py2.py3-none-any.whl

Collecting pyaudio (from -r requirements.txt (line 2))

Using cached PyAudio-0.2.11.tar.gz

Building wheels for collected packages: pyaudio

Running setup.py bdist_wheel for pyaudio ... error

Complete output from command /home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-QShDtG/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('

', '

');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmp9IBfgPpip-wheel- --python-tag cp27:

running bdist_wheel

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

copying src/pyaudio.py -> build/lib.linux-x86_64-2.7

running build_ext

building '_portaudio' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

/bin/false -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o

error: command '/bin/false' failed with exit status 1


Failed building wheel for pyaudio

Running setup.py clean for pyaudio

Failed to build pyaudio

Installing collected packages: SpeechRecognition, pyaudio

Running setup.py install for pyaudio ... error

Complete output from command /home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-QShDtG/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('

', '

');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-ObcFB4-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/include/site/python2.7/pyaudio --home=/tmp/tmp93Wh_5:

running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

copying src/pyaudio.py -> build/lib.linux-x86_64-2.7

running build_ext

building '_portaudio' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

/bin/false -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o

error: command '/bin/false' failed with exit status 1


Command "/home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-QShDtG/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('

', '

');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-ObcFB4-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/include/site/python2.7/pyaudio --home=/tmp/tmp93Wh_5" failed with error code 1 in /tmp/pip-build-QShDtG/pyaudio/

STDERR:

Traceback (most recent call last):

File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main

"main", fname, loader, pkg_name)

File "/usr/lib/python2.7/runpy.py", line 72, in _run_code

exec code in run_globals

File "/home/proctronics/Desktop/test/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 905, in

main()

File "/home/proctronics/Desktop/test/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 902, in main

ToolchainCL()

File "/home/proctronics/Desktop/test/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 508, in init

getattr(self, args.subparser_name.replace('-', '_'))(args)

File "/home/proctronics/Desktop/test/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 147, in wrapper_func

build_dist_from_args(ctx, dist, args)

File "/home/proctronics/Desktop/test/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 190, in build_dist_from_args

build_recipes(build_order, python_modules, ctx)

File "pythonforandroid/build.py", line 585, in build_recipes

File "pythonforandroid/build.py", line 626, in run_pymodules_install

File "pythonforandroid/logger.py", line 175, in shprint

File "/home/proctronics/.local/lib/python2.7/site-packages/sh.py", line 863, in next

self.wait()

File "/home/proctronics/.local/lib/python2.7/site-packages/sh.py", line 792, in wait

self.handle_command_exit_code(exit_code)

File "/home/proctronics/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code

raise exc

sh.ErrorReturnCode_1:

RAN: /bin/bash -c source venv/bin/activate && env CC=/bin/false CXX=/bin/false PYTHONPATH=/home/proctronics/Desktop/test/.buildozer/android/platform/build/build/python-installs/blue/lib/python2.7/site-packages pip install --target '/home/proctronics/Desktop/test/.buildozer/android/platform/build/build/python-installs/blue/lib/python2.7/site-packages' --no-deps -r requirements.txt

STDOUT:

Collecting SpeechRecognition (from -r requirements.txt (line 1))

Using cached SpeechRecognition-3.7.1-py2.py3-none-any.whl

Collecting pyaudio (from -r requirements.txt (line 2))

Using cached PyAudio-0.2.11.tar.gz

Building wheels for collected packages: pyaudio

Running setup.py bdist_wheel for pyaudio ... error

Complete output from command /home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-QShDtG/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('

', '

');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmp9IBfgPpip-wheel- --python-tag cp27:

running bdist_wheel

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

copying src/pyaudio.py -> build/lib.linux-x86_64-2.7

running build_ext

building '_portaudio' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

/bin/false -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o

error: command '/bin/false' failed with exit status 1


Failed building wheel for pyaudio

Running setup.py clean for pyaudio

Failed to build pyaudio

Installing collected packages: SpeechRecognition, pyaudio

Running setup.py install for pyaudio ... error

Complete output from command /home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-QShDtG/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('

', '

');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-ObcFB4-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/include/site/python2.7/pyaudio --home=/tmp/tmp93Wh_5:

running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

copying src/pyaudio.py -> build/lib.linux-x86_64-2.7

running build_ext

building '_portaudio' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

/bin/false -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o

error: command '/bin/false' failed with exit status 1


Command "/home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-build-QShDtG/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('

', '

');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-ObcFB4-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/proctronics/Desktop/test/.buildozer/android/platform/build/build/venv/include/site/python2.7/pyaudio --home=/tmp/tmp93Wh_5" failed with error code 1 in /tmp/pip-build-QShDtG/pyaudio/

STDERR:

Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=blue --bootstrap=sdl2 --requirements=kivy,hostpython2,SpeechRecognition,pyaudio --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/proctronics/Desktop/test/.buildozer/android/platform/build

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

Thanks in advance.

1
Could you please be more verbose? Consider editing the question and adding the full error logJuggernaut
@Juggernaut that is the full output after trying to install the requirements.mhd ammar

1 Answers

1
votes

According to this link, only pure python package can be installed automatically, all the packages that depends of binary compilation must have a recipe written.

A recipe is a script that contain the “definition” of a module to compile. The directory layout of a recipe for a is something like:

python-for-android/recipes//recipe.sh

python-for-android/recipes//patches/

python-for-android/recipes//patches/fix-path.patch When building, all the recipe build must go to:

python-for-android/build// For example, if you want to create a recipe for sdl, do:

cd python-for-android/recipes mkdir sdl cp recipe.sh.tmpl

sdl/recipe.sh sed -i 's#XXX#sdl#' sdl/recipe.sh Then, edit the

sdl/recipe.sh to adjust other information (version, url) and complete build function.