I have a Flask server in a Python file. It's really simple:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello World!"
if __name__ == '__main__':
app.run()
I'm using Kivy's Buildozer to build my file. After creating buildozer.spec
and specifying requirements = kivy,flask
I try to build with buildozer -v android debug
which should build the APK.
Instead, it crashes in the middle of building and gives me this error:
File "setup.py", line 4, in
from setuptools import setup
ImportError: No module named setuptools
This setup.py
is Buildozer's, not mine.
I uninstalled setuptools completely with sudo apt-get purge python-setuptools
, sudo -H pip uninstall setuptools
, and I removed the easy_install command from /usr/local/bin (both easy_install
and easy_install-2.7
). I run sudo easy_install
and it says it's not there. Good.
Then I follow instructions from here, and I run wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
. It installs successfully, and I test that easy_install is there by doing sudo easy_install
and checking at /usr/local/bin
. I also go into the Python shell and type from setuptools import setup
and it works. So, setuptools is installed. However, buildozer -v android debug
still fails with the same error.
Could someone figure out what's happening? Setuptools is installed; why is Buildozer not finding it?
This is my log, with log_level = 2 in buildozer.spec: Link
You are using the old python-for-android toolchain, which does not support a flask backend. Run buildozer android_new debug
instead to use the new toolchain.