Unable to run 'pipx list' on Termux (Android)

See original GitHub issue

Running pipx list on Termux results in following stack trace:

venvs are in /data/data/com.termux/files/home/.local/pip
x/venvs
apps are exposed on your $PATH at /data/data/com.termux/
files/home/.local/bin
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.7/mu
ltiprocessing/synchronize.py", line 28, in <module>
    from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'SemLock' from '_multipr
ocessing' (/data/data/com.termux/files/usr/lib/python3.7
/lib-dynload/_multiprocessing.cpython-37m.so)

During handling of the above exception, another exceptio
n occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.local/bin/pipx
", line 10, in <module>
    sys.exit(cli())
  File "/data/data/com.termux/files/home/.local/pipx/ven
vs/pipx/lib/python3.7/site-packages/pipx/main.py", line 
547, in cli
    exit(run_pipx_command(parsed_pipx_args))
  File "/data/data/com.termux/files/home/.local/pipx/ven
vs/pipx/lib/python3.7/site-packages/pipx/main.py", line 
198, in run_pipx_command
    commands.list_packages(venv_container)
  File "/data/data/com.termux/files/home/.local/pipx/ven
vs/pipx/lib/python3.7/site-packages/pipx/commands.py", l
ine 638, in list_packages
    with multiprocessing.Pool() as p:
  File "/data/data/com.termux/files/usr/lib/python3.7/mu
ltiprocessing/context.py", line 119, in Pool
    context=self.get_context())
  File "/data/data/com.termux/files/usr/lib/python3.7/mu
ltiprocessing/pool.py", line 158, in __init__
    self._setup_queues()
  File "/data/data/com.termux/files/usr/lib/python3.7/mu
ltiprocessing/pool.py", line 251, in _setup_queues
    self._inqueue = self._ctx.SimpleQueue()
  File "/data/data/com.termux/files/usr/lib/python3.7/mu
ltiprocessing/context.py", line 112, in SimpleQueue
    return SimpleQueue(ctx=self.get_context())
  File "/data/data/com.termux/files/usr/lib/python3.7/mu
ltiprocessing/queues.py", line 332, in __init__
    self._rlock = ctx.Lock()
  File "/data/data/com.termux/files/usr/lib/python3.7/mu
ltiprocessing/context.py", line 66, in Lock
    from .synchronize import Lock
  File "/data/data/com.termux/files/usr/lib/python3.7/mu
ltiprocessing/synchronize.py", line 32, in <module>
    " synchronization primitives needed will not" +
ImportError: This platform lacks a functioning sem_open 
implementation, therefore, the required synchronization 
primitives needed will not function, see issue 3770.

This is on OnePlus 5T with Android 9.0.

Technically it’s a Python and/or Android issue, where multiprocessing module isn’t working because Android kernel is lacking in semaphores syscalls. Also see https://bugs.python.org/issue3770

AFAIK there is still a way to workaround this, but it would require switching multiprocessing to threading module. For example, this is how black dealt with similar issue: https://github.com/psf/black/pull/533

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
cs01commented, May 18, 2020

Glad it’s working. Thanks for following back up so we could get this fixed.

2reactions
pschmittcommented, May 18, 2020
$ pip install -U pipx
$ pipx list
venvs are in /data/data/com.termux/files/home/.local/pipx/venvs
apps are exposed on your $PATH at /data/data/com.termux/files/home/.local/bin
   package flake8 3.8.1, Python 3.8.3
    - flake8

Thanks, @cs01 !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to run 'pipx list' on Termux (Android) #229 - GitHub
Running pipx list on Termux results in following stack trace: venvs are in /data/data/com.termux/files/home/.local/pip x/venvs apps are ...
Read more >
Troubleshooting - pipx
Troubleshooting · reinstall-all fixes most issues · Diagnosing problems using list · Specifying pipx options · Check for PIP_* environment variables · pipx...
Read more >
errors installing python on termux android N OS - Stack Overflow
Have you run apt update && apt upgrade recently to ensure you have the latest version of the system?
Read more >
Termux Useful Tweaks - DEV Community ‍ ‍
Termux is an Android terminal emulator and Linux environment app ... pip3 install pipx pipx ensurepath # make sure to set path pipx...
Read more >
How to fix pip install error in Termux - YouTube
termux #shorts #termuxpipdistribution not found pip install error fixed. ... try restarting your device. Your browser can't play this video.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found