-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run 'pipx list' on Termux (Android) #229
Comments
Thanks for the suggestion on the workaround. I am guessing that is the way to go. Pull requests welcome if you want to give it a shot. |
Platforms like Android Termux do not have support for semaphores and thus cannot use `multiprocessing.Pool` Use the multiprocessing.dummy package as a fallback, which provides the Pool API backed by a ThreadPool. Fixes #229
Sorry for necrobumping but I still encounter the error on Termux with pipx 0.15.1.3. |
This is the PR that closed it is #277. The diff is small, maybe you could take a look and see if it looks like it should work on your platform. Are you still getting the same error? |
On a fully updated version of Termux you get the following: Click to expand! (Spoiler: it's the same error as reported by OA)
I dug a little further and it turns out that $ python3 -c "from multiprocessing.dummy import Pool; Pool()"
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/synchronize.py", line 28, in <module>
from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'SemLock' from '_multiprocessing' (/data/data/com.termux/files/usr/lib/python3.8/lib-dynload/_multiprocessing.cpython-38.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/dummy/__init__.py", line 124, in Pool
return ThreadPool(processes, initializer, initargs)
File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/pool.py", line 925, in __init__
Pool.__init__(self, processes, initializer, initargs)
File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/pool.py", line 196, in __init__
self._change_notifier = self._ctx.SimpleQueue()
File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/context.py", line 113, in SimpleQueue
return SimpleQueue(ctx=self.get_context())
File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/queues.py", line 336, in __init__
self._rlock = ctx.Lock()
File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/context.py", line 67, in Lock
from .synchronize import Lock
File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/synchronize.py", line 30, in <module>
raise ImportError("This platform lacks a functioning sem_open" +
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770. |
Thanks. Let me know if this branch fixes it |
|
I commented too early. Hang on. |
Jup. That works @cs01 ! Thanks. |
Thanks, @cs01 ! |
Glad it’s working. Thanks for following back up so we could get this fixed. |
Running
pipx list
on Termux results in following stack trace: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/issue3770AFAIK there is still a way to workaround this, but it would require switching
multiprocessing
tothreading
module. For example, this is howblack
dealt with similar issue: psf/black#533The text was updated successfully, but these errors were encountered: