I have python 3.7.3 installed on my Android phone using Termux. While i tried import synchronize from multiprocessing in python shell i receive the above error. Here is my code
from multiprocessing import synchronize
Here is Traceback
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.7/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/home/storage/predictions/env/lib/python3.7/lib-dynload/_multiprocessing.cpython-37m.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data/data/com.termux/files/usr/lib/python3.7/multiprocessing/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.
After it i tried to see mentioning 3770 issue but seems that url on official website isn't work. Can anyone help me solve this problem
This issue is unsolvable unless you're an Android developer as stated by the error message itself.
sem_open
is a function used to initialise or open an existing POSIX semaphore. A semaphore is a variable that is shared between threads and it is a system level component in rather crude terms. Android distributions lack this component and, hence, there is nothing you can do.
I spent a lot time to solve this problem and decided to open bug report on termux github page and receive answer from termux developers Android supports multiprocessing, but not semaphores.
Here is a link to full explanation of problem and question and answer thread https://github.com/termux/termux-app/issues/1272
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With