# Can't use multiprocessing module to spawn python process on windows for CPU bound works

**URL:** <https://forums.ankiweb.net/t/cant-use-multiprocessing-module-to-spawn-python-process-on-windows-for-cpu-bound-works/71225>\
**Category:** Development\
**Created:** [September 27, 2026, 2:55pm UTC](https://forums.ankiweb.net/t/cant-use-multiprocessing-module-to-spawn-python-process-on-windows-for-cpu-bound-works/71225 "2026-09-27T14:55:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobobo](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@bobobo](https://forums.ankiweb.net/u/bobobo)\
**Post date:** [September 27, 2026, 2:55pm UTC](https://forums.ankiweb.net/t/cant-use-multiprocessing-module-to-spawn-python-process-on-windows-for-cpu-bound-works/71225/1 "2026-09-27T14:55:11Z")

</div>

I’m trying to use the spawn method of multiprocessing to create query workers,

On linux, I can use fork mode, but I can’t use multiprocessing spawn mode directly, because multiprocess will spawn anki with some special command line options as worker which anki not recognize and will fail,I did some hacks and successfully spawned the python process in anki folder,

but on windows, there’s no python exe in anki installation folder, only pythonxxx.dll, which makes it impossible to use multiprocess.

I can’t use threading.Thread because of GIL which is not suitable for CPU bound tasks.

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [September 27, 2026, 4:14pm UTC](https://forums.ankiweb.net/t/cant-use-multiprocessing-module-to-spawn-python-process-on-windows-for-cpu-bound-works/71225/2 "2026-09-27T16:14:30Z")

</div>

> [@bobobo](#):
>
> but I can’t use multiprocessing spawn mode directly, because multiprocess will spawn anki with some special command line options as worker which anki not recognize and will fail

It’s a limitation in the new packaging method in 26.05+: [Stub binary doesn't support `sys.executable` spawn/multiprocessing · Issue #4 · beeware/briefcase-linux-system-template · GitHub](https://github.com/beeware/briefcase-linux-system-template/issues/4)

> [@bobobo](#):
>
> but on windows, there’s no python exe in anki installation folder, only pythonxxx.dll, which makes it impossible to use multiprocess.

Briefcase removes python.exe on Windows by default, but it looks like it’s easy for us to change that.

I’ll log these issues on GitHub.

---

<div class="post-metadata">

**Author:** ![bobobo](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@bobobo](https://forums.ankiweb.net/u/bobobo)\
**Post date:** [September 28, 2026, 11:37am UTC](https://forums.ankiweb.net/t/cant-use-multiprocessing-module-to-spawn-python-process-on-windows-for-cpu-bound-works/71225/3 "2026-09-28T11:37:04Z")

</div>

Good to hear that.  
I’m current using a walk around, that is compiling a thin c wrapper that loads pythonxxx.dll and run the Py\_Main, links against windows api only, the result exe is only 3kB, but I think bundling the addon with an exe is not a good idea.

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [September 28, 2026, 5:15pm UTC](https://forums.ankiweb.net/t/cant-use-multiprocessing-module-to-spawn-python-process-on-windows-for-cpu-bound-works/71225/4 "2026-09-28T17:15:21Z")

</div>

Logged here:

> <https://github.com/ankitects/anki/issues/5723>
>
> Report: https://forums.ankiweb.net/t/cant-use-multiprocessing-module-to-spawn-py…thon-process-on-windows-for-cpu-bound-works/71225
> 
> It's an issue in the Briefcase stub binaries: https://github.com/beeware/briefcase-linux-system-template/issues/4
> 
> We should coordinate with upstream to fix this.
