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.

How do you use multiprocessing with this?

See original GitHub issue

OS: Windows 10 64 bit. Python 3.6.6 v3.6.6:4cf1f54eb7 64 bit Nuitka: First tried stable then tried the development Nuitka 0.5.33rc5 Python3.6 64 bit MSI I installed it with that. Short example:

import multiprocessing
import time

class Test(object):

    def __init__(self):
        self.process = multiprocessing.Process(target=self.run, args=())
        self.process.daemon = True

    def start(self):
        self.process.start()

    def stop(self):
        self.process.terminate()

    def run(self):
        while True:
            print('Never happening')
            time.sleep(1.5)

Test().start()

The error changes based on what the process is doing. Example:

Traceback (most recent call last):
  File "test.py", line 28, in <module __parents_main__>
  File "test.py", line 15, in start
  File "multiprocessing\process.py", line 105, in start
  File "multiprocessing\context.py", line 223, in _Popen
  File "multiprocessing\context.py", line 322, in _Popen
  File "multiprocessing\popen_spawn_win32.py", line 65, in __init__
  File "multiprocessing\reduction.py", line 60, in dump
TypeError: Can't pickle instancemethod objects

My program (closed source):

Traceback (most recent call last):
  File "app.py", line 233, in <module __parents_main__>
  File "multiprocessing\spawn.py", line 74, in freeze_support
  File "multiprocessing\spawn.py", line 99, in spawn_main
  File "multiprocessing\reduction.py", line 82, in steal_handle
OSError: [WinError 87] The parameter is incorrect

Whats the correct way to build a standalone with multiprocessing?

I used this (and many other combinations before that)

nuitka test.py --standalone --recurse-all --python-flag=no_site --plugin-enable=multiprocessing --recurse-plugin=multiprocessing --show-modules

Awesome work!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
kayhayencommented, Aug 23, 2018

Released as part of 0.5.32.7

1reaction
kayhayencommented, Aug 26, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

multiprocessing — Process-based parallelism — Python 3.11 ...
multiprocessing is a package that supports spawning processes using an API similar to the threading module. The multiprocessing package offers both local ...
Read more >
Python Multiprocessing Example - DigitalOcean
Python multiprocessing Pool can be used for parallel execution of a function across multiple input values, distributing the input data across ...
Read more >
Multiprocessing in Python - MachineLearningMastery.com
Multiprocessing is the ability of a system to run multiple processors at one time. If you had a computer with a single processor,...
Read more >
Multiprocessing in Python | Set 1 (Introduction) - GeeksforGeeks
To import the multiprocessing module, we do: import multiprocessing · To create a process, we create an object of Process class. · To...
Read more >
A beginners guide to Multi-Processing in Python
Multi-Processing in Python using Process class- ... Now let us get our hands on the multiprocessing library in Python. ... The above code...
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