Kivy Android Scikitlearn
Question: I'm trying to build a test Android application based on Kivy and Scikitlearn.
To build the apk I use buildozer. The code of the app is the basic Hello world
example. In the buildozer.spec file I add scikit-learn as an external library:

    
    
    [app]
    
    title = MyTest
    
    package.name = kivycrash2
    
    package.domain = org.test
    
    source.dir = .
    
    source.include_exts = py,png,jpg,kv,atlas
    
    version = 0.1
    
    requirements =  kivy, numpy, scikit-learn
    
    orientation = landscape
    

When I try to build the apk, I get following error:

    
    
     ImportError: Numerical Python (NumPy) is not installed.
        scikit-learn requires NumPy >= 1.6.1.
    

I have also tried to put sklearn instead of scikit-learn with no success. Is
it possible to satisfy the Numpy required version?

Thank you.


Answer: The problem here is that scikit-learn is searching for a numpy installation
during its own setup, but it doesn't know to look in the android build
directory where numpy has been built for the android architecture. I'd try
creating a python-for-android recipe for scikit-learn (rather than your
current method which tries to use pip) that either patches it to override the
numpy check, or possibly tries to let it detect numpy correctly by adding the
right directory to the PYTHONPATH - but I'm not sure if that would work, it
depends on what it tries to import during installation.

There are also other possibilities, e.g. the new python-for-android toolchain
possibly has a way to let setup.py find numpy automatically, but this doubles
the numpy build time and still requires that you make a recipe.

