pydantic-core on termux
anyone having issue with python project development on termux? whether using vanilla pip, uv or poetry. everytime i add spotdl as dependency, it needs to compile pydantic-core. worse things happened with uv and poetry. everytime i run main.py, they both recompile pydantic-core and it took like 20 mins. does this related to the python version? i also read on several github issues about python on termux, most libraries aren't compatible with bionic libc or something
Solution:Jump to solution
The development workflow I would recommend for Python in Termux is currently this:
1. Install
python-pip and any other python-* dependencies that you need that are available from pkg in Termux
2. after that, do not use a virtualenv. Instead, use pip install unsandboxed directly to install any remaining PyPi dependencies you need that are not available from pkg, and just wait a long time, if you see an error, open a report about it.
3. uv has problems currently with Termux, there are several issues about this including an upstream issue, avoid it in favor of pip instead
4. just keep this state saved in your Termux while you do Python development, if you don't want to wait 20 minutes every time you use a new device, you can use termux-backup and termux-restore to transfer your Termux content to another device. This will only work if both devices are 32-bit ARM, or both devices are 64-bit ARM. If you need to transfer to another device that is a different architecture, then you have to do all your setup commands again and wait, there is no alternative...8 Replies
when using vanilla pip, did it eventually work, or did it eventually have an error and not work?
Solution
The development workflow I would recommend for Python in Termux is currently this:
1. Install
python-pip and any other python-* dependencies that you need that are available from pkg in Termux
2. after that, do not use a virtualenv. Instead, use pip install unsandboxed directly to install any remaining PyPi dependencies you need that are not available from pkg, and just wait a long time, if you see an error, open a report about it.
3. uv has problems currently with Termux, there are several issues about this including an upstream issue, avoid it in favor of pip instead
4. just keep this state saved in your Termux while you do Python development, if you don't want to wait 20 minutes every time you use a new device, you can use termux-backup and termux-restore to transfer your Termux content to another device. This will only work if both devices are 32-bit ARM, or both devices are 64-bit ARM. If you need to transfer to another device that is a different architecture, then you have to do all your setup commands again and wait, there is no alternativeusing vanilla pip also compiles the pydantic-core (ig this is normal) and running the script works fine w/ just python main.py
i've asked the same question on uv discord community. they said it's termux's problem
ask them about this issue
GitHub
uv pip list does not read all system packages in sys.path and i...Executing uv pip list --system does not list any packages. Similarly for freeze and show subcommands (I did not test any others). $ uv pip list --system -vv uv_interpreter::find_python::find_defaul...
well, don't actually,
because they already know about that issue, so if you bother them in an annoying way about it that would be rude,
but basically if that
uv issue gets fixed some time, then after that uv would be able to work better in termux
yes it's normal for pip packages to spend a long time compilingah okay but same thing happened with poetry
okay it's resolved ig. at least i alr know the actual problem. thanks @owokitty
yeah but global install would bloat the requirements.txt though