Nick Collins
Nick Collins

Reputation: 1

Cant build libpython with `math` module using buildozer

When I do buildozer android debug it produces a number of libpython3.11.so (which is what I want) but none of them contain the math builtin module (I check that nm -D libpython3.11.so | grep PyInit_math finds nothing).

I just want a libpython3.11.so for android (api level 27, ndk r25c) that can do basic math (as in whatever is in import math). I've tried various args in buildozer.spec such as --enable-math (per suggestions from Claude) to no avail. I tried adding math to my requirements, but I get:

[DEBUG]:    ERROR: Could not find a version that satisfies the requirement math (from versions: none)
[DEBUG]:    ERROR: No matching distribution found for math

It seems that none of the default recipes include math? At least none that I can find. I really don't want to have to make my own recipe since that seems really complicated when the only thing I want is math. I guess there's a numpy recipe so I could try switching all my code from basic math to numpy, but that also feels like overkill (and my default expectation is that things won't work, so I don't want to go to the effort just to find it doesn't work for reasons I don't understand).

I also tried using other requirements instead of math, such as setuptools in the hope that they will somehow get math added, but it doesn't seem to work.

I understand that builds for android are kept minimal to cut down on size, but I don't understand when/where math is actually being excluded, or how to un-exclude it. Claude doesn't understand these things either. It feels like there should be an easy way to include something as fundamental as math. I'd rather not move off buildozer and work directly with p4a or my own build from source of python, because I'm going to be doing this process w/ other platforms (e.g. windows, iOS) in the future, so I'd like one system that can build the python lib for all platforms.

Thank you!

Tried:

Expected:

Upvotes: 0

Views: 63

Answers (0)

Related Questions