Android Enthusiasts
Q&A for enthusiasts and power users of the Android operating system
Latest Questions
2
votes
1
answers
6932
views
How to install new Python modules in the Dcoder app?
The [Dcoder][1] app supports the Python programming language. However, for a code that requires 3rd-party modules (e.g. [mlxtend][2]), it will show the following error when running: ![Dcoder app showing the error][3] ``` Traceback (most recent call last): File "fun.py", line 7, in fro...
The Dcoder app supports the Python programming language. However, for a code that requires 3rd-party modules (e.g. mlxtend ), it will show the following error when running:

Traceback (most recent call last):
File "fun.py", line 7, in
from mlxtend.data import iris_data
ImportError: No module named mlxtend.data
Process finished with exit code 1.
How to install new Python modules in the Dcoder app?
Soheil Paper
(153 rep)
Jan 26, 2020, 07:57 PM
• Last activity: May 28, 2025, 06:03 AM
0
votes
2
answers
587
views
How to install Python on Android 4.0?
My Samsung Galaxy Tab 10.1 P7510 is running Android 4.0.4. I have root access to the device. I want to install Python on my device. How to install Python on Android 4.0?
My Samsung Galaxy Tab 10.1 P7510 is running Android 4.0.4. I have root access to the device. I want to install Python on my device.
How to install Python on Android 4.0?
Hamza Ahmed
(111 rep)
Oct 5, 2016, 11:34 AM
• Last activity: Jan 4, 2025, 09:30 AM
0
votes
1
answers
870
views
Is there a way to access the wide-angle camera in Xiaomi Redmi 9 from the computer?
I'm currently trying to access the wide-angle camera that Xiaomi Redmi 9 has. My end-goal is to be able to stream frames from the camera in a Python script (using [openCV](https://opencv-python-tutorials.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html#capture-vide...
I'm currently trying to access the wide-angle camera that Xiaomi Redmi 9 has. My end-goal is to be able to stream frames from the camera in a Python script (using [openCV](https://opencv-python-tutorials.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html#capture-video-from-camera)) . But knowing how to access this camera from the computer will be enough.
So far, I've tried to do this by using [Droidcam](https://play.google.com/store/apps/details?id=com.dev47apps.droidcam) , [iVcam](https://play.google.com/store/apps/details?id=com.e2esoft.ivcam) and [IP Webcam](https://play.google.com/store/apps/details?id=com.pas.webcam) . They work great with the main camera, but I'm unable to use the wide-angle one.
I've found a similar question https://android.stackexchange.com/questions/231153/app-cant-see-wide-angle-camera-in-xiaomi-redmi-note-9 , but I believe that my question may be different as it's more specific.
Javier TG
(101 rep)
May 6, 2021, 07:55 PM
• Last activity: Apr 18, 2024, 01:31 PM
4
votes
1
answers
974
views
How to run Python 2 and Python 3 CLI programs on Android 14 phones?
It looks like all the methods which used to work for running Python 2 and Python 3 CLI programs on Android phones is now outdated: * SL4A * QPython * Termux + python packages I can't believe we can't run Python CLI programs on Android 14. How would I go about it?
It looks like all the methods which used to work for running Python 2 and Python 3 CLI programs on Android phones is now outdated:
* SL4A
* QPython
* Termux + python packages
I can't believe we can't run Python CLI programs on Android 14.
How would I go about it?
Victor Ramos
(193 rep)
Apr 8, 2024, 01:54 PM
• Last activity: Apr 9, 2024, 10:40 AM
9
votes
1
answers
11585
views
How do you root a device with Magisk when it doesn't have a custom recovery
This is a self answered question to address the subject of title. With a recovery in place, rooting with Magisk is straightforward,it gets a tad difficult when you don't have a recovery.This was vaguely addressed in https://android.stackexchange.com/questions/200113/stock-image-dump-for-running-magi...
This is a self answered question to address the subject of title.
With a recovery in place, rooting with Magisk is straightforward,it gets a tad difficult when you don't have a recovery.This was vaguely addressed in https://android.stackexchange.com/questions/200113/stock-image-dump-for-running-magisk-necessary/200114#comment306071_200114 .
So, I thought of making a self answered question to
* Help those who don't know and
* Add to canonical questions. It's important for our site to have such questions as easy reference (not-so-subtle request to others to post more self answered questions!).
**Notes:**
1. I have tried both Linux and Android versions of the answer and they work fine (tested on Pixel 4a, Android 11). The process *may* look daunting but it isn't (I know nothing about Linux, yet managed to root without issues).
2. Moderators are free to make this a community wiki, if more answers are posted depending on the device variants :)
beeshyams
(41525 rep)
Dec 24, 2020, 11:19 AM
• Last activity: Jul 9, 2023, 09:38 AM
1
votes
0
answers
83
views
Does Android have a system Python?
This is a random question. In a typical Android phone (say for example Pixel 6), is there an installation of CPython? I mean Python that's used internally by the system, rather than available to the user or through some third-party app. If so, what version of Python?
This is a random question. In a typical Android phone (say for example Pixel 6), is there an installation of CPython? I mean Python that's used internally by the system, rather than available to the user or through some third-party app.
If so, what version of Python?
Ram Rachum
(909 rep)
May 20, 2023, 04:45 PM
0
votes
0
answers
139
views
Alternative installation source for QPython Plugin for Tasker
I am trying to get the QPython Plugin for Tasker from the UK Google Play but despite using voucher credit, it is denied. The creator's email address is not valid. So I am wondering if anybody has a compiled APK using files from GitHub Qpython Tasker, I do not know how to compile these. Thank you for...
I am trying to get the QPython Plugin for Tasker from the UK Google Play but despite using voucher credit, it is denied. The creator's email address is not valid.
So I am wondering if anybody has a compiled APK using files from GitHub Qpython Tasker, I do not know how to compile these. Thank you for any help.
barney
(1 rep)
Jan 11, 2023, 06:36 PM
• Last activity: Jan 12, 2023, 06:04 AM
1
votes
1
answers
589
views
How to install vdirsyncer on Android?
I would like to use [vdirsyncer](https://github.com/pimutils/vdirsyncer) on android. To do so, I first installed [termux](https://f-droid.org/en/packages/com.termux/) and than ran: ```sh apt install python python3 pip3 install vdirsyncer ``` However, that throws the warning: > Warning pip is configu...
I would like to use [vdirsyncer](https://github.com/pimutils/vdirsyncer) on android. To do so, I first installed [termux](https://f-droid.org/en/packages/com.termux/) and than ran:
apt install python python3
pip3 install vdirsyncer
However, that throws the warning:
> Warning pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Then it tries that 4 times, after which it says:
> Could not fetch URL https://pypi.org/simple/vdirsyncer there was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org, port=443)
> Error: could not find a version that satisfies the requirement vdirsyncer (from versions: none)
So it seems to me I should either ensure ssl module is available on Python, or reconfigure pip with locations that do not require TLS/SSL. I have not yet found out how to do that, hence, I would like to ask:
How can one install vdirsyncer on Android?
a.t.
(399 rep)
Jan 2, 2023, 06:52 PM
• Last activity: Jan 3, 2023, 11:24 AM
3
votes
2
answers
3193
views
Install Python to run speedtest-cli on Android phone with no access to device - via adb
I want to install Python on an Android phone (the phone is connected to a Raspberry Pi so I don't have any GUI or physical access to the device). I can connect to the phone via `adb shell` and run/install packages via APK files easily. I want to install Python on the device to run `speedtest-cli` re...
I want to install Python on an Android phone (the phone is connected to a Raspberry Pi so I don't have any GUI or physical access to the device). I can connect to the phone via
adb shell
and run/install packages via APK files easily. I want to install Python on the device to run speedtest-cli
remotely via adb shell
. https://github.com/sivel/speedtest-cli
speedtest-cli
requires Python. So far I have tried the following based on online articles.
1. Installed Termux app via APK. I can access the underlying files remotely. I tried to install python using pkg
command but could not. Error below.
1|:/data/data/com.termux/files/usr/bin # ./pkg install python
This must NOT be run as root as it will break your environment (root will be required for nearly everything due to changed file permissions)
1|marlin:/data/data/com.termux/files/usr/bin # whoami
root
2. Installed Qpython on the device using adb. However, the issue is that when I launch adb command to launch Qpython, I see a prompt on the device - "Allow Qpython to access media Options - Accept or Deny". Since I don't have access to the device, I can't select either of the options. Is there a way to send a command via ADB to select - Accept?
I would appreciate any other ideas as well. My end goal is to run the speedtest-cli
utility via adb shell
on a device that is not physically accessible.
rfguy
(51 rep)
Aug 3, 2019, 11:20 PM
• Last activity: Jan 3, 2023, 03:35 AM
1
votes
2
answers
7018
views
How can I run a Python script in terminal emulator?
I tried running a Python script in a terminal emulator (app) with `./script.py` and I get an error saying "permission denied". It is to run a Twitter bot even if I close the app. So, I googled how to do this and it said I have to download a file called `python.sh`, but their link is down so I can't...
I tried running a Python script in a terminal emulator (app) with
./script.py
and I get an error saying "permission denied". It is to run a Twitter bot even if I close the app.
So, I googled how to do this and it said I have to download a file called python.sh
, but their link is down so I can't download it. When I google the file, I only get results for how to load .sh
files in Python.
How I can do this?
FlamingBurrito15
(23 rep)
Sep 2, 2018, 03:10 AM
• Last activity: Oct 17, 2022, 01:14 PM
2
votes
1
answers
1756
views
Setting up Python so that it can be run on any Android terminal apps
I'm trying to get Python 3 to run natively on Android. By "native", I mean native Linux, just an Android variation of it. I'd like to be able to simply open a terminal and type `python /path/to/script.py`, so Kivy and Qslide will not work (to my knowledge, feel free to prove me wrong). Normally, Ter...
I'm trying to get Python 3 to run natively on Android. By "native", I mean native Linux, just an Android variation of it. I'd like to be able to simply open a terminal and type
python /path/to/script.py
, so Kivy and Qslide will not work (to my knowledge, feel free to prove me wrong). Normally, Termux would do this, but I don't like the terminal app just the Linux packages it supplies, prefer to use another called Terminal Emulator by Jackpal.
I've tried booting into TWRP (I don't have root otherwise) and copying the necessary Python binaries and lib folder and the Termux data directory to /system/bin
and /system/lib
, but Python fails, saying it can't find libandroid-support.so
. I realize Termux's Python is probably modified in some way to account for the directory structure required by an Android app and therefore couldn't find the .so
even after I copied it to /system/lib
.
So my question(s) are: How might I make the solution I tried work? Are there any other ways to get Python installed as a native Linux app*?
---
*Like I said, I want it to be just like on a desktop Linux where I can open ANY terminal app and use python
just like any other command.
Myersj281
(21 rep)
Dec 8, 2018, 05:49 PM
• Last activity: Oct 17, 2022, 01:11 PM
4
votes
1
answers
13655
views
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects in Android Termux
I'm trying to install numpy in Termux in Android and I'm getting this error : ```sh ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects ``` I tried ```sh apt update && apt upgrade ``` And got this error : ```sh CANNOT LINK EXECUTABLE "/data/data/com.te...
I'm trying to install numpy in Termux in Android and I'm getting this error :
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
I tried
apt update && apt upgrade
And got this error :
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/apt/methods/https": library "libssl.so.1.1" not found
The second error happened the second time i run apt update && apt upgrade
is there any solution?
DevProd_
(43 rep)
May 12, 2022, 12:40 PM
• Last activity: Aug 24, 2022, 02:07 AM
0
votes
0
answers
92
views
Add pkt, apt or any other packet manager onto the Oneplus Nord
On my phone any kind of packet manager is missing. With that - presumably - it is possible to install python on Android. Not even dpkg or rpm are available (curl would be available though). Is there maybe some kind of magisk module or are there any online-ressources available where I can download th...
On my phone any kind of packet manager is missing. With that - presumably - it is possible to install python on Android. Not even dpkg or rpm are available (curl would be available though). Is there maybe some kind of magisk module or are there any online-ressources available where I can download the packet manager binaries that would be executeable on an Oneplus Nord? I know it's available on other phones, like the Fairphone 4.
Cowboy_Patrick
(11 rep)
Aug 14, 2022, 09:51 AM
0
votes
1
answers
1410
views
How to enable pip, QPython to write to Android filesystem?
I have been following this guide to install youtube-dl on my Android phone. http://www.arulraj.net/2015/11/download-any-videos-in-android-using-youtube-dl.html However, when downloading the videos, I get the following error. ERROR: unable to open for writing: [Errno 30] Read-only file system: How wo...
I have been following this guide to install youtube-dl on my Android phone.
http://www.arulraj.net/2015/11/download-any-videos-in-android-using-youtube-dl.html
However, when downloading the videos, I get the following error.
ERROR: unable to open for writing: [Errno 30] Read-only file system:
How would I be able to give write permissions to the pip console of QPython so I can write to a folder on /sdcard?
Running Android Marshmallow 6.0 with root access.
user161557
(1 rep)
Apr 18, 2016, 03:00 AM
• Last activity: Mar 25, 2022, 06:03 AM
1
votes
1
answers
977
views
Python 3 on Android using TerminalIDE
I want to code Python 3 on my Android device. So I went through [Lanky Cyril's blog](http://blog.lankycyril.com/post/39473303019) post on using the Terminal IDE to put all that I needed to do code on an Android terminal. For Python 2.X that is installed on the blog, it works like a charm. So I insta...
I want to code Python 3 on my Android device. So I went through [Lanky Cyril's blog](http://blog.lankycyril.com/post/39473303019) post on using the Terminal IDE to put all that I needed to do code on an Android terminal. For Python 2.X that is installed on the blog, it works like a charm.
So I installed Python 3 using the same instructions. This is what I get when I try to start Python 3:
terminal++:~$ ~/python3
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
Segmentation fault
I made sure:
export PYTHONHOME=/data/data/com.googlecode.python3forandroid/files/python3
export PYTHONPATH=${PYTHONHOME}/lib/python3.2/lib-dynload
I also checked on why [python 3 is not loading ](https://stackoverflow.com/questions/5694706/py-initialize-fails-unable-to-load-the-file-system-codec) on StackOverflow.
So the problem could be the python build. Has anyone worked around this?
Afrowave
(121 rep)
Mar 24, 2014, 02:13 PM
• Last activity: Feb 19, 2022, 01:07 AM
1
votes
0
answers
2346
views
Running a python script on an Android device
I need to control an android app using a python script. Currently, I connect my phone to my laptop and use adb (android debug bridge). Process: 1. Laptop sends an adb shell command to android to take a snapshot of the screen 2. Android sends the snapshot to my laptop for processing 3. Python/laptop...
I need to control an android app using a python script. Currently, I connect my phone to my laptop and use adb (android debug bridge).
Process:
1. Laptop sends an adb shell command to android to take a snapshot of the screen
2. Android sends the snapshot to my laptop for processing
3. Python/laptop will process the snapshot by analyzing a series of pixels to detect a change in shapes on screen and decide what action to take (tap, swipe, ...)
4. Python/laptop will send an adb shell tap or swipe command to the android device
5. Android will execute the action
The problem is that this process is a little slow and it binds my phone to my laptop.
Is there a way to have the python script live on the android device directly making decisions and taking actions? The closest I have found so far is using Termux, but what library could I use to replace adb? (To analyse the content of the screen, send tap/swipe actions?)
willer2k
(111 rep)
Nov 19, 2021, 08:09 PM
1
votes
0
answers
1033
views
How can I downgrade/compile Python in Termux?
I started using `termux` 1-2 weeks ago and I'm in love with it. Funnily, the first days in, everything worked fine and then a Python update hit, and I can no longer use my Python plugins in Neovim. It requres v3.9 or earlier. I tried searching online and asking in Termux discord about how to downgra...
I started using
termux
1-2 weeks ago and I'm in love with it. Funnily, the first days in, everything worked fine and then a Python update hit, and I can no longer use my Python plugins in Neovim. It requres v3.9 or earlier.
I tried searching online and asking in Termux discord about how to downgrade Python to v3.9 or how to fix this but got nothing so far.
I would appreciate it if someone could tell me a solution or point me in a better direction about fixing the issue on my own.
Not Amused
Oct 22, 2021, 07:04 PM
• Last activity: Oct 30, 2021, 11:45 AM
1
votes
0
answers
58
views
Boot-Up System Test tools
I am a test automation script developer using Python. One of my recents tasks has been to create scripts that can output the following test cases from an Android device under test during boot-up: -Identification - SW Ver, SN, CPU, memory,.... -Memory test - bad block count -DDR Training -Peripheral...
I am a test automation script developer using Python. One of my recents tasks has been to create scripts that can output the following test cases from an Android device under test during boot-up:
-Identification - SW Ver, SN, CPU, memory,....
-Memory test - bad block count
-DDR Training
-Peripheral inventory check
-Error logging
Ideally, this would all be done via adb interface, but I don't know what tools or commands are available to do such tests. Some are trivial such as SW ver, SN. But others like the memory test, and ddr training are new to me.
If anyone can point me in the right direction in terms of adb commands and/or test apps, that would be great.
I'm not an Android developer nor do I know Java so my knowledge of the inner workings of Android is very sparse.
Bill
(111 rep)
Jun 2, 2021, 06:25 PM
0
votes
0
answers
664
views
Android Bootchart log analysis
We're running Android 11 on the custom board. We're using [bootchart][1] tool for calculating the Android bootup time. Bootchart logs which are generated after enabling bootchart for which we're not able to generate graphic chart using the command **"pybootchartgui bootchart.tgz"**. We're getting be...
We're running Android 11 on the custom board. We're using bootchart tool for calculating the Android bootup time. Bootchart logs which are generated after enabling bootchart for which we're not able to generate graphic chart using the command **"pybootchartgui bootchart.tgz"**. We're getting below error when tried to generate the image.
parsing 'bootchart.tgz'
parsing 'header'
parsing 'proc_stat.log'
parsing 'proc_ps.log'
warning: no parent for pid '2' with ppid '0'
parsing 'proc_diskstats.log'
merged 0 logger processes
pruned 222 process, 0 exploders, 2 threads, and 1 runs
False
Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 23, in
sys.exit(main())
File "/usr/lib/python2.7/dist-packages/pybootchartgui/main.py", line 137, in main
render()
File "/usr/lib/python2.7/dist-packages/pybootchartgui/main.py", line 128, in render
batch.render(writer, res, options, filename)
File "/usr/lib/python2.7/dist-packages/pybootchartgui/batch.py", line 41, in render
draw.render(ctx, options, *res)
File "/usr/lib/python2.7/dist-packages/pybootchartgui/draw.py", line 282, in render
draw_chart(ctx, IO_COLOR, True, chart_rect, [(sample.time, sample.util) for sample in disk_stats], proc_tree)
File "/usr/lib/python2.7/dist-packages/pybootchartgui/draw.py", line 201, in draw_chart
yscale = float(chart_bounds) / max(y for (x,y) in data)
ZeroDivisionError: float division by zero
I searched for other utilities which can analyze bootchart logs, but I couldn't found any. How can I fix the above error or any other method for calculating the bootup time?
Raja
(111 rep)
Mar 2, 2021, 06:58 AM
• Last activity: Mar 2, 2021, 09:59 AM
3
votes
1
answers
260
views
Android execute script at logout
I would like to execute a script at logout with my GS7 android 9 (Resurrection Remix). I see that it is advised to use tasker. I guess it is possible to do that without installing a graphical application. I connect to the smartphone through adb and have a shell. Where can I write a file in the file...
I would like to execute a script at logout with my GS7 android 9 (Resurrection Remix). I see that it is advised to use tasker. I guess it is possible to do that without installing a graphical application.
I connect to the smartphone through adb and have a shell. Where can I write a file in the file system with bash or python commands that will be executed at logout ? Also, how should I manage the bash or python environment in order to have it working ?
Thanks for your time.
yoarch
(31 rep)
Dec 18, 2020, 10:55 AM
• Last activity: Dec 20, 2020, 10:22 AM
Showing page 1 of 20 total questions