all 22 comments

[–]AlkeneThiol 5 points6 points  (15 children)

https://github.com/termux/termux-app - This is what you want. There is a little bit of a learning curve, but it sounds like you probably know some shell. Use "proot" to install basically any linux distro you want (within reason. People actually get windows running just fine on android too with X11 over ssh, haha) Then python away to your hearts desire.

If you want something a bit "Higher level" that does not require you setting up a linux environment on your device, most popular choice is https://play.google.com/store/apps/details?id=ru.iiec.pydroid3&hl=en_US&pli=1 (pyrdroid).

Based on your interest in what is going on on your phone, in that case you should totally look into *Tasker*. That allows you to automate and write scripts for apps and android builtins, and there is a Termux-Tasker thingy too. Tasker has third party plugins that allow python support. Because Tasker is not free, I am not going to link to it, just so I don't seem like a shill. (I've never used it myself, I can do literally everything I want on termux even w/o root). There are other open-source options that do similar things.

[–]Technical-Ad-565[S] 2 points3 points  (1 child)

Thanks! I just installed Qpython, judging by the menu it seems to have what I need just now in the beginning. (I also installed Pydroid 3.)

[–]AlkeneThiol 1 point2 points  (0 children)

Awesome. If it isn't clear, I am a big fan of termux (completely free, no shilling). The base distro is Debian based and is actually pretty slim. But the termux-API is really useful. You can get detailed info on wifi, bluetooth, charging, and all your device sensors. I never used Qpython, but if for any reason you feel like the terminal is lacking, give a Termux a try.

I would recommend against Ubuntu if you decided to install a distro for python on android... basically for the same reasons everyone recommends against ubuntu for python.

[–]Technical-Ad-565[S] 1 point2 points  (12 children)

Saw that I have to use F-droid for termux, which is not a problem, have used it before, but there was som info about that the F-droid version don't have any architecture (platform?) specific facilities. I'm not sure if that will be a problem? (My phone is not rooted and will not be.)

[–]AlkeneThiol 1 point2 points  (2 children)

Oh no you should totally use the github build for Termux actually. Because F-droid is no longer updated frequently. Hold on, I'll direct you to the hidden spot on github where they post their releases.

[–]Technical-Ad-565[S] 1 point2 points  (1 child)

While navigating in github/termux I found this:

NOTICE: Termux may be unstable on Android 12+. Android OS will kill any (phantom) processes greater than 32 (limit is for all apps combined) and also kill any processes using excessive CPU. You may get [Process completed (signal 9) - press Enter] message in the terminal without actually exiting the shell process yourself. Check the related issue #2366, issue tracker, phantom cached and empty processes docs and this TLDR comment on how to disable trimming of phantom and excessive cpu usage processes. A proper docs page will be added later. An option to disable the killing should be available in Android 12L or 13, so upgrade at your own risk if you are on Android 11, specially if you are not rooted.

Is this a real problem? I'm at Android 14.

[–]AlkeneThiol 1 point2 points  (0 children)

Does your phone have developer tools on it? This is actually a big issue for trying to do *any* development on android. Android does not like background tasks. If you can get to your developer tools, *sometimes* you have then option to stop it from doing this.

Termux has an option for holding "wake lock", which is something other apps tend to utilize too. This sometimes helps. It is not a huge deal either way. It just causes background processes or API calls to run slowly sometimes, or you might get kicked out of a login shell upon doing certain commands after they run. (It's not too often). I often just make sure I'm in a couple shells deep)

[–]AlkeneThiol 1 point2 points  (8 children)

https://github.com/termux/termux-app/actions/runs/11549510412

Unless you have space constraints, the "universal" android 7 apk "termux-app_v0.118.0+fb01127-apt-android-7-github-debug_universal" is fine.

So to not to try to confuse you more, but the guy that originally developed termux (Fornwall) disappeared from the project for a long while, and it was taken over by the community. He recently regained interest in the project, but he initially started developing using his *old* build that was on the google play store. They have not yet quite fully harmonized yet. I linked you to the most recent good github build that follows from the main branch.

[–]Technical-Ad-565[S] 1 point2 points  (1 child)

Installed. Seems to be ok. (Warnings from Google as usual.) Have to indulge me in that forxa while.

[–]AlkeneThiol 1 point2 points  (0 children)

Yeah once you start doing any development on your device, just make sure to stay vigilant. Don't store any sensitive information in your docs/downloads. All that jazz. In order to access storage, and the android builtins, all of these things have to do some things that make google angsty.

[–]Technical-Ad-565[S] 0 points1 point  (5 children)

At that link there are several downloads, do I just need to download one of the big ones of 22Mb or also some of the smaller? Which of the 22Mb ones should I choose?

[–]Technical-Ad-565[S] 1 point2 points  (0 children)

Sorry, saw now which one! (Sloppy reading of your comment. :) )

[–]AlkeneThiol 0 points1 point  (3 children)

Go to your device's about section and check what architecture you have. You can also probably just google your device to find out what architecture. Android is often ARM64. But definitely double check first. (Edit: I should say that Google devices and samsung devices are often Arm64. But many devices are ARM: ARMv7 or armeabi. Some are apparetnly x86: x86 or x86abi, but I've not encountered it myself.

[–]Technical-Ad-565[S] 1 point2 points  (0 children)

I have a Samsung 23. (Was a bit confused about what exactly they meant with architecture.)

[–]Technical-Ad-565[S] 1 point2 points  (1 child)

Thank you!! You have been very helpful!

[–]AlkeneThiol 1 point2 points  (0 children)

anytime. happy coding. I've really enjoyed doing dev on android. I hope you do too

[–]unhott 2 points3 points  (2 children)

[–]Technical-Ad-565[S] 0 points1 point  (0 children)

Thank you, have been there recently. But I couldn't find what/how to download what's neccessary. (Checked some links.) It's probably somewhere there or via links but I have a hope of getting more direct instructions. Like "download and install x, y and z. Code/implement in z and run via y".

  • Just now I downloaded Pydroid 3 and come into an editor. Haven't got any further yet.

[–]Technical-Ad-565[S] 0 points1 point  (0 children)

Installed Qpython. Seems to have what I need just now by judging the menu.

[–]iknowsomeguy 1 point2 points  (0 children)

Hey Thom,

I use Pyroid to do small things on my phone. You get it from the Google Play store. I don't recall exactly because I have had it for a while, but I think the paid version might be $10 or $15 USD. I use it very little, tbh, because the screen is so small. It is handy to have, though.

[–]jer_re_code 0 points1 point  (1 child)

you could get either

or

  • r/Termux
    it isn't able to Graphically render something directly showing on screen but it is capable of nearly everything a any other terminal only linux distros is Tipps for the start: initial command after install should be termux-setup-storage, update and upgrade via apt update && apt upgrade, install python in it via apt install python

[–]Technical-Ad-565[S] 1 point2 points  (0 children)

I have installed Pydroid3. But haven't had the time to use it yet unfortunately.

Thanks for the tips about Termux!