Install python3.6 on Termux android terminal emulator - python

I am tring to excetute a GitHub pyton script on my Android smartphon using Termux.
I knew that this script doesn't run on Python 3.8.1 (which is the default version installed when typed "pkg install python" but it runs very well on previous versions of linux. I have to mention that I know this since I was running this script on my laptop and I have different version of python installed.
However, I've looked for a couple of days in a row on google and I didn't find a way to install an older python version on my Termux. Could you please help me out on this?
Thanks in advance,
Lorenzo

Unlike regular Linux Distributions, Termux does not keep a history of the version updates hence installing Python 3.6 is a difficult task, but it's not impossible, you'll have to build and install python from its source code. Which you can find (for version 3.6.10) here : https://www.python.org/downloads/release/python-3610/
And if you need help with installation, I'd ask you to follow the guide here without the sudo commands. (https://docs.rstudio.com/resources/install-python-source/)

pkg i python==[version]
you specify the version you want just after the package name. That is
pkg i python==3.6 -y
considering 3.6 is the version then the -y simply means yes

its actually pkg i python=3.6 and termux don't have that python version

Related

How to install Python 3.8 along with Python 3.9 in Arch Linux?

I'm working with tensorflow. Recently Arch replaced Python 3.8 with 3.9 and at the moment there is no tensorflow build for Python 3.9. Downgrading Python version for the whole system for that single reason do not looks like good idea for me. My goal is to create virtual environment with python 3.8.
Is there a way to have both (3.8 and 3.9) versions available in the system? Python page of arch wiki doesn't mention that.
EDIT:
I know, I can use: virtualenv -p python3.8 py38 but I need an interpreter in the system.
Go for package python38 in AUR, if you have an AUR helper like yay just use yay -S python38. Otherwise, just download the PKGBUILD and install manually with makepkg.
You can also update python with pacman -Syu (which is now python3.9). Then the two shall live together, inside /usr/bin/python3.x.
Use virtual environment to manage them if you like, virtualenv --python=/usr/bin/python3.x yourenvname.
Downgrading Python version for the whole system for that single reason do not looks like good idea for me.
This is a good observation. You should not modify the system installation of python. After you install the AUR package that Ahacad mentions. I suggest using virtualenv or the standard venv package to create a virtual environment for your tensorflow projects.

Need to run Python 3.8.x on Termux on Android, currently installed with Python 3.9

I have just installed the latest Termux on my Android device and Python 3.9 is the default Python installation. I need to run Python 3.8.x due to some package incompatibilities.
My searching tells me there is no way to downgrade Python within Termux - is this correct?
If I install a previous version of Termux, will this in turn install an earlier version of Python or will it just collect the same default version?
Is there another way for me to make this change?
I've encountered something similar over the past few days!
Here is a summary of the solution given by #kcubeterm on Reddit, who has very kindly provided a way to install python 3.8X on Termux.
Remove python 3.9 if you have it installed:
pkg uninstall python
Make a note of the architecture of your device's CPU using this command:
uname -m
Go to https://github.com/Termux-pod/termux-pod and find the file corresponding to your device's CPU. According to #kcubeterm, you should try python_3.8.6_.deb first and then the static version if there is any error.
Download the raw .deb file in termux using web-get.
make sure you add ?raw=true to the end of the url, or else you'll end up downloading the html file!
wget https://github.com/Termux-pod/termux-pod/blob/main/arm/python/python_3.8.6_<CPU_ARCH.>.deb?raw=true
Finally, execute the following command in termux:
dpkg -i ./python_3.8.6_<CPU_ARCH.>.deb
Once again, replacing <CPU_ARCH.> with your cpu's architecture (for me it was arm).
Hope this answer helped you to install Python 3.8! I love termux but find it frustrating that they provide no way to install non-bleeding edge versions of packages!
Thanks again to #kcubeterm who provided this solution.
git clone the termux-packages repo
then cd to the packages/python folder
git log build.sh to find the commit with the version you want
checkout that commit (for the entire repo, to be sure)
then follow the standard instructions at
https://wiki.termux.com/wiki/Building_packages
Otherwise you don't know what kind of binary you are installing. Build it yourself to be sure. I'd wanna be sure.
It doesn't depends upon the Version of termux. It depends upon the repository. And it always update it's packages . So i think there is no way
install pypy3 using apt
# apt search python
.
.
.
pypy/stable 7.3.9-1 aarch64
A fast, compliant alternative implementation of Python
.
.
.
# pypy3 --version
Python 3.8.13 (4b1398fe9d76ad762155d03684c2a153d230b2ef, Apr 25 2022, 09:26:53)
[PyPy 7.3.9 with GCC Clang 14.0.1]

Upgrading Ubuntu Python 3.8.2 to Python 3.8.5

I have a fresh install of Ubuntu that has Python 3.8.2. I am also starting university soon, and the professor would like us students to use Python 3.8.5. So far, I have only found instructions on how to update Python 2.x.x or 3.x.x to Python 3.8.x and not 3.8.x to 3.8.x, so I was wondering how should i go about the process in my case?
Doing this is simple and does not necessarily require 100% usage on the terminal, and there is practically no difference between an x.x.x to an x.x.y, but to install
Acess this link
First, let's remove the current version with:
sudo apt remove python
then
Unzip in your preferred folder
Open the folder in the terminal and type: ./install-sh
Be happy

Error when installing Tensorflow - Python 3.8

I'm new to programming and following a course where I must install Tensorflow. The issue is that I'm using Python 3.8 which I understand isn't supported by Tensorflow.
I've downloaded Python 3.6 but I don't know how to switch this as my default version of python.
Would it be best to set up a venv using python 3.6 for my program and install Tensorflow in this venv?
Also, I using Windows and Powershell.
Tensorflow is only supported until python 3.7 as of now.
You can check it here: https://www.tensorflow.org/install/pip
But there is a way to install it on Python3.8, just run the below command that will do your job:
python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
This command work on mac and windows both, I haven't tested on Linux.
You should always use venv because by default every project on your system will use these same directories to store and retrieve site packages (third party libraries). At first glance, this may not seem like a big deal, and it isn’t really, for system packages (packages that are part of the standard Python library), but it does matter for site packages.
Consider the following scenario where you have two projects: ProjectA and ProjectB, both of which have a dependency on the same library, ProjectC. The problem becomes apparent when we start requiring different versions of ProjectC. Maybe ProjectA needs v1.0.0, while ProjectB requires the newer v2.0.0.
You can also take a look at anaconda, it’s the most populasr data sciencie platform and will be easy for you install tensorflow and jupiter notebook in just 2 clicks. Anaconda
Uninstall all your python versions and use the latest anaconda.
$ conda create --name tensorflow python=3.5
This way you create a virtual environment with python 3.5 which is supported by tensorflow.
So now you can install it.
$ activate tensorflow
(tensorflow) $ pip install tensorflow
it would have been nice if you would have the share the error screenshot
though as per i got the case
tensorflow work in both 3.8 and 3.6 just you have to check that you have 64bit version not 32 bit
you can acess both version from thier respective folder no need to install a venv
If you don't want to use Anaconda or virtualenv, then actually multiple Python versions can live side by side. I use Python38 as my default and Python35 for TensorFlow until they release it for Python38. If you wish to use the "non-default" Python, just invoke with the full path of the python.exe (or create a shortcut/batch file for it). Python then will take care of using the correct Python libs for that version.
Worked on Python 3.8.2 (default, Mar 05 2020, 18:58:42) [GCC] on linux
pip3 install --upgrade tf-nightly
Python Versions 3.5 - 3.8 are supported now.
You can verify on this page:
https://www.tensorflow.org/install/pip

Should Which Pip and Which Python Return the Same Directory? Zeppelin Configuration On Unix RHEL

This is probably a really dumb question but I am stuck and wasting too much time on this so I would SO appreciate any help.
I am using a RHEL 7 box and installed Apache Zeppelin on it. Everything works except for the life of me I can't import Python packages such as Pandas.
I realized I didn't have PIP so I installed it with these steps: https://pip.pypa.io/en/stable/installing/ (notice I had to use the "--user" argument for the command "python get-pip.py").
Finally, I did "pip install pandas --user" which worked perfectly. I then go into my Zeppelin notebook and I cannot import pandas, even after restarting the Python interpreter.
I did some research and I think the problem is that "which python" and "which pip" are installed in different directories as the former results in "/usr/bin/python" while the latter in "~/.local/bin/pip".
So I suspect the packages installed with pip are basically getting loaded into a different version of python? If it helps, when I do "whereis python" I get 5 different results such as "/usr/bin/python" and "/usr/bin/python2.7" etc.
First thing to understand is: Python packages aren't installed globally, every installed Python has its own set of packages. BTW, pip being a Python package with a script is also not global. If you have a few different pythons you need different pips for them. I don't know Apache Zeppelin so I cannot guess if it uses the system Python (/usr/bin/python) or has its own Python; in the latter case you need to install pip specifically for Zeppelin so its pip install packages available for Zeppelin.
To investigate to what Python pip installs packages you need to find out under what python it runs. Start with shebang:
head -1 `which pip`
The command will prints something like ~/.local/bin/python. If it's not the version of Python you need to install packages for you need to install a different pip using that Python.
The most complex case would be if the shebang is PATH-dependent, something like #!/usr/bin/env python. In that case pip runs Python that you can find with which python.
PS. AFAIK the simplest way to install pip at RedHat is dnf install python-pip.
phd's answer was very helpful but I found that it was just a matter of using the root account to install the python packages. Then my Zeppelin was able to see any packages.

Categories

Resources