Comments (8)
Thank you for letting me know. I'll have a look.
from mantichora.
For reference,
defining task_loop() in another python file and importing, it'll be ok.
from mantichora.
Yes, I'm just working on this now. The code in this branch might work.
from mantichora.
I released the version 0.9.8.
It works fine in Python 3.8 on Jupyter Notebook in my environment.
Please let me know if the problem persists.
The cause of the problem appears to be the change in the default start method in multiprocessing in Python 3.8. The default start method was "fork" until Python 3.7. But it changed to "spawn" in Python 3.8. The spawn method has more restrictions on how the main module is written as described in this section of the document for mulriprocessing. The mantichora version 0.9.8 uses the "fork" mode.
from mantichora.
@TaiSakuma
Thanks for your quick fix and detail explaination!
After upgrading to 0.9.8, the above demo code work well,
but I get the following error:
when using mantichora background, code like:
def task_func(*args)
for i in atpbar(...):
do some network things
return something
def parallel_func()
split something into K parts
task_partial = partial(task_func, ...)
with mantichora() as mcore:
for i in range(K):
mcore.run(task_partial, ...)
mcore.receive_all()
It works fine by 0.9.7.
from mantichora.
Thank you for letting me know. I will look into it.
from mantichora.
I released mantichora version 0.9.9.
I added the option mp_start_method
to mantichora()
so that uses can choose the start method of multiprocessing. The possible values are fork
, spawn
, and forkserver
. The default is fork
. For example, if you would like to use the spawn method, which was used in mantichora v0.9.7 in Python 3.8, you can do so as
mantichora(mp_start_method='spawn')
The spawn
and forkserver
mothods have more restrictions, which are already mentioned above in this issue.
If you need to use the fork
method, you might get the same error of may have been in progress in another thread when fork() was called
. If you are getting the same error and you are on MacOS, setting the environment variable OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
might solve the problem as suggested at StackOverflow here, which you might have found already.
Please let me know if this doesn't solve the problem or causes other problems.
Thank you.
from mantichora.
I assume that the issue has been resolved. Please create a new issue if not.
from mantichora.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mantichora.