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.

Problem with multiprocessing context

See original GitHub issue

I am currently experiencing the following issue when running sockeye-train:

[INFO:sockeye.training] Training started.
[INFO:sockeye.utils] Releasing GPU 0.
[ERROR:root] Uncaught exception
Traceback (most recent call last):
  File "/usr/local/bin/sockeye-train", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/sockeye/train.py", line 825, in main
    train(args)
  File "/usr/local/lib/python3.6/dist-packages/sockeye/train.py", line 955, in train
    existing_parameters=args.params)
  File "/usr/local/lib/python3.6/dist-packages/sockeye/training.py", line 627, in fit
    process_manager = DecoderProcessManager(self.model.output_dir, decoder=decoder)
  File "/usr/local/lib/python3.6/dist-packages/sockeye/training.py", line 1282, in __init__
    self.ctx = mp_utils.get_context()  # type: ignore
  File "/usr/local/lib/python3.6/dist-packages/sockeye/multiprocessing_utils.py", line 71, in get_context
    assert __context is not None, ("Multiprocessing context not initialized. Please call "
AssertionError: Multiprocessing context not initialized. Please call sockeye.multiprocessing_utils.initialize() right after interpreter startup.

Any idea what could be causing this?

I am running sockeye using mxnet-cu100mkl inside a singularity container.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jamesewoocommented, Jul 1, 2019

Could it be that when running the generated cli script sockeye-train the train.py is not considered __main__?

I think this is the case. If you look at setup.py it points directly to sockeye.train:main.

Since the multiprocessing init method checks if it’s already been called, could you simply remove the if condition?

0reactions
fhiebercommented, Jul 9, 2019

#704 was merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiprocessing Context in Python
Multiprocessing contexts provide a more flexible way to manage process start methods directly within a program, and may be a preferred approach ...
Read more >
Python multiprocessing isn't working any more, even the ...
I got the error AttributeError: module 'multiprocessing.util' has no attribute '_args_from_interpreter_flags' when running a program of mine ...
Read more >
Default multiprocessing context is broken and should never be ...
The default multiprocessing context (on POSIX systems) is fork-without-exec. As a result, all process state is mirrored in the subprocesses, ...
Read more >
multiprocessing — Process-based parallelism — Python 3.11 ...
Context objects have the same API as the multiprocessing module, and allow one ... It is an error to attempt to join a...
Read more >
Why your multiprocessing Pool is stuck (it's full of sharks!)
On Linux, the default configuration of Python's multiprocessing library can lead to deadlocks and brokenness. Learn why, and how to fix it.
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