question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fall back to serial mode does not work in current version

See original GitHub issue

I tried to use joblib with Chaquopy, but Android does not have a functioning sem_open implementation, so I received the following warning as expected:

_multiprocessing_helpers.py:38: UserWarning: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.. joblib will operate in serial mode

With joblib 0.11, the import still succeeds. But with joblib 0.13.0 it fails, because joblib unconditionally imports loky, which unconditionally imports multiprocessing.synchronize.

Traceback from https://github.com/chaquo/chaquopy/issues/21#issuecomment-448568723 (edited for clarity):

 File "/android_asset/chaquopy/requirements-common.zip/joblib/__init__.py", line 119, in <module>
    from .parallel import Parallel
  File "/android_asset/chaquopy/requirements-common.zip/joblib/parallel.py", line 33, in <module>
    from .externals import loky
  File "/android_asset/chaquopy/requirements-common.zip/joblib/externals/loky/__init__.py", line 11, in <module>
    from .backend.context import cpu_count
  File "/android_asset/chaquopy/requirements-common.zip/joblib/externals/loky/backend/__init__.py", line 13, in <module>
    from multiprocessing import synchronize
  File "stdlib/multiprocessing/synchronize.py", line 34, in <module>
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:9

github_iconTop GitHub Comments

2reactions
mhsmithcommented, Nov 24, 2019

Running this workaround before the import will allow it to succeed:

import _multiprocessing
_multiprocessing.sem_unlink = None

Of course, process-based parallelism will still not work if the underlying platform doesn’t support it, so you’ll have to use the parallel_backend context manager to use thread-based parallelism instead.

0reactions
mhsmithcommented, Jul 28, 2020

Chaquopy 8.0.1 now has a workaround for this problem. Process-based parallelism is still unavailable, but joblib can at least be imported, and then you can use the parallel_backend context manager to use thread-based parallelism instead.

To upgrade, edit your app’s top-level build.gradle file and change the version number of com.chaquo.python:gradle.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - ESP32-S3 - — esptool.py latest ...
No serial data received. Wrong boot mode detected (0xXX)! The chip needs to be in download mode. Download mode successfully detected, but getting...
Read more >
Modem-HOWTO: Troubleshooting
Another reason may be that whatever is on the serial port (such as a modem, terminal, printer) doesn't work as fast as you...
Read more >
Troubleshoot EC2Launch v2 - Amazon Elastic Compute Cloud
This section shows common troubleshooting scenarios for EC2Launch v2, information about viewing Windows event logs, and console log output and messages.
Read more >
Troubleshooting using the serial console - Google Cloud
Install or update to the latest version of the Google Cloud CLI. ... troubleshoot an issue that occurs after VM has booted past...
Read more >
Find your lost AirPods - Apple Support
About Find My · Locate your AirPods on a map · Play a sound on your AirPods · Get an alert if you...
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