Search code examples
pythontermux

This platform lacks a functioning sem_open implementation, thefore, the required synchronization primitives needed


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


Solution

  • 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