-
Notifications
You must be signed in to change notification settings - Fork 507
nbdev_prepare throws BrokenProcessPool error on MacOS #731
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
Comments
Can you please provide a link to a github repo where you get this error? |
Here is the empty repo I'm using for reproducing errors: https://github.com/WNoxchi/testrepo I'm migrating a project to nbdev2 and decided to start fresh. https://github.com/WNoxchi/alphazero locally contains code ported over from https://github.com/WNoxchi/alphazero_prev (though now that it seems like export + clean isn't an issue, I'm going to update it tomorrow -- 10-12 hours from now). |
Message ID: ***@***.***>Those don't seem to have anything in them. I need access to a repo where I can run the command that's giving you problems and see the error that you're seeing. Then I'll be able to fix it!
|
The example repo is up at: https://github.com/WNoxchi/alphazero_temp I discovered a second issue while putting it together: when calling Export and clean work, The export error on a dictionary containing a class object:
|
Sorry @WNoxchi I might not be explaining very well what we need. In your issue you said "I replicated the error with an empty test public repo after upgrading to nbdev 2.1.1." That's the repo we need a link to. The empty test public repo which you're seeing the error in. The link you provided is to a repo where you've got quite a bit of code and stuff, and we're not going to be able to wrap our heads around all that!
We'd love to help you fix that, but GitHub Issues isn't really the place. This is for filing reproducible bug reports. We need one issue per bug report. For help with your code, would you mind discussing it either on the forums on discord first? If it turns out it's due to a bug in nbdev, we can then create an issue here to track fixing the bug. Sorry -- hope this isn't too inconvenient! |
No problem, I'll put a post up on the forum later today. |
This looks the same as 673, which seemed fixed for a time. This error is re-ocurring for me now, even without upgrading from Example repo here. I did nothing but (ml9) michael.fishman@michael nbdev_prepare_broken_example % nbdev_prepare
objc[5744]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[5744]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Traceback (most recent call last):
File "/Users/michael.fishman/miniconda3/envs/ml9/bin/nbdev_prepare", line 33, in <module>
sys.exit(load_entry_point('nbdev', 'console_scripts', 'nbdev_prepare')())
File "/Users/michael.fishman/repos/nbdev/nbdev/shortcuts.py", line 101, in prepare
nbdev_test.__wrapped__()
File "/Users/michael.fishman/repos/nbdev/nbdev/test.py", line 87, in nbdev_test
results = parallel(test_nb, files, skip_flags=skip_flags, force_flags=force_flags, n_workers=n_workers, pause=pause, do_print=do_print)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/parallel.py", line 117, in parallel
return L(r)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/foundation.py", line 98, in __call__
return super().__call__(x, *args, **kwargs)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/foundation.py", line 106, in __init__
items = listify(items, *rest, use_list=use_list, match=match)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/basics.py", line 66, in listify
elif is_iter(o): res = list(o)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/concurrent/futures/process.py", line 559, in _chain_from_iterable_of_lists
for element in iterable:
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/concurrent/futures/_base.py", line 609, in result_iterator
yield fs.pop().result()
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/concurrent/futures/_base.py", line 446, in result
return self.__get_result()
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending. Environment:
Edit: Updated my environment info |
Thanks @MichaelJFishmanBA I'll take a look now. |
@MichaelJFishmanBA I tried cloning your repo and ran Can you confirm running nbdev_export works OK in that repo for you? Then can you try |
Edit: |
Ouch OK that's going to be hard to debug! How about if you first run |
Also, can you run |
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
nbdev_test runs without error.
|
@MichaelJFishmanBA I've updated execnb in master to avoid importing fastcore.xtras and fastcore.foundation. I wonder if that will fix it. Could you try installing execnb and nbdev from master and see if that resolve it (be sure to |
I
I still get this error: (ml9) michael.fishman@michael nbdev_prepare_broken_example % nbdev_test
objc[19935]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[19935]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Traceback (most recent call last):
File "/Users/michael.fishman/miniconda3/envs/ml9/bin/nbdev_test", line 33, in <module>
sys.exit(load_entry_point('nbdev', 'console_scripts', 'nbdev_test')())
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/script.py", line 116, in _f
return tfunc(**merge(args, args_from_prog(func, xtra)))
File "/Users/michael.fishman/repos/nbdev/nbdev/test.py", line 87, in nbdev_test
results = parallel(test_nb, files, skip_flags=skip_flags, force_flags=force_flags, n_workers=n_workers, pause=pause, do_print=do_print)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/parallel.py", line 117, in parallel
return L(r)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/foundation.py", line 98, in __call__
return super().__call__(x, *args, **kwargs)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/foundation.py", line 106, in __init__
items = listify(items, *rest, use_list=use_list, match=match)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/site-packages/fastcore/basics.py", line 66, in listify
elif is_iter(o): res = list(o)
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/concurrent/futures/process.py", line 559, in _chain_from_iterable_of_lists
for element in iterable:
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/concurrent/futures/_base.py", line 609, in result_iterator
yield fs.pop().result()
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/concurrent/futures/_base.py", line 446, in result
return self.__get_result()
File "/Users/michael.fishman/miniconda3/envs/ml9/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending. |
OK I'll leave this open until we have a more resilient approach to running NBs, but in the meantime, please just set |
Pretty sure the commit I just pushed would have to fix this -- lemme know if it doesn't. It's not forking the parent process at all any more. |
I still get the error after upgrading to nbdev==2.1.3
fastcore==1.5.16
execnb==0.1.1 I'll use the |
Someone else with this problem told us upgrading python solved it for them fyi |
I am getting the same error in a similar environment, initially with Python 3.9.11 and still after upgrading to Python 3.10.3. I am installing my library with
The
|
Uh oh!
There was an error while loading. Please reload this page.
On NBDev 2.1.1, fastcore 1.5.14.
In (Arm) MacOS, running
nbdev_prepare
results in the following error:This first occurred using (I believe) nbdev 2.0.8 on a public repo ready for a commit. I replicated the error with an empty test public repo after upgrading to nbdev 2.1.1.
Steps to reproduce:
nbdev_new
nbdev_install_hooks
nbdev_export
nbdev_install
nbdev_prepare
I was not able to replicate this issue on (arm64) Ubuntu 20.04 linux:
nbdev_prepare
runs successfully there. Note: in this linux testnbdev_new
did not infer settings.ini, but did successfully take manual input.I remember
BrokenProcessPool
errors in fastai years ago on MacOS, they were solved by setting the number of workers to 1 (or some other work around).Update: Looks like the issue is in
nbdev_test
(nbdev_export
andnbdev_clean
work without issue). I don't have tests but there wasn't an issue on linux.The text was updated successfully, but these errors were encountered: