12

I am installing Python in Termux, but I am getting this error:

pkg install python

Output:

Checking availability of current mirror: ok
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package python
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Binson Thangjam
  • 127
  • 1
  • 1
  • 5

9 Answers9

19

I think you haven't updated the repository. It looks like you have just installed Termux. Anyway, execute

apt update

and then install any package.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Krishna Kanhaiya
  • 428
  • 3
  • 10
14

The following combination of answers from this post worked for me:

  1. termux-setup-storage
  2. termux-change-repo (I selected Albatros)
  3. pkg update and pkg upgrade
  4. exit and then restart termux
  5. pkg install python -y
Andreas Violaris
  • 2,465
  • 5
  • 13
  • 26
12

Termux has halted all updates through Google Play. Download it from F-Droid. Then change the mirror. It works (sometimes).

termux-change-repo

Or change it manually by editing the sources.list file in directory $PREFIX/etc/apt.

Check out my blog post for more links.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Th3cr00k3dm4n
  • 121
  • 1
  • 3
7

Download it from F-Droid instead of Google Play.

The link is *https://f-droid.org/en/packages/com.termux/.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vibhu Pandey
  • 101
  • 1
  • 4
3

Make sure you have an Internet connection, and then allow access to your storage.

Run termux-setup-storage. This should ask you for permissions to allow termux to use your device storage.

Then to confirm storage is accessible, run ls ~/storage/shared to list directories contained in shared storage.

If this doesn't work, try switching repositories as some other answers suggest, as the node you're on may be down.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ruzor
  • 31
  • 3
  • Hi ruzor and welcome to SO. Maybe you can show in your answer more details about the output of these commands :) . Anyway I think would be nice if you read this: https://stackoverflow.com/help/how-to-answer – Carmoreno Jul 10 '21 at 00:52
1

Try to upgrade your Termux via pkg upgrade. Then it finds the packages on pkg.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Berke Şentürk
  • 119
  • 1
  • 12
1

Only for mobile Termux:

termux-change-repo

There might be services for game and science needed to select all the three options and select the A1batross's options, thereby completing all the permission process steps.

Once done with all these steps, you can install and do operation as a Linux terminal.

PS: update the apt would be better before any other steps

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
renish p.r
  • 105
  • 1
  • 5
0

I changed my Termux repository to A1batross'.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Silver
  • 1
  • Can you elaborate? It is too close to [Albatross](https://en.wikipedia.org/wiki/Albatross_(disambiguation)) to give any meaningful search results. For example, where did you change it? Exactly how did you change it? Does it actually contain the number "1"? – Peter Mortensen Jul 23 '23 at 13:51
  • [Another answer](https://stackoverflow.com/questions/65210662/how-to-fix-e-unable-to-locate-package-python-on-termux/71097459#71097459) uses Albatross, not A1batross. – Peter Mortensen Jul 23 '23 at 13:58
-1

Just give storage permissions and restart the application. It worked fine for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Satwik
  • 11