# Python Multiprocessing Bug fix?

**URL:** <https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310>\
**Category:** Python\
**Created:** [January 9, 2024, 1:51pm UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310 "2024-01-09T13:51:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phyrokar](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/p/3bc359/32.png) [@Phyrokar](https://community.stereolabs.com/u/Phyrokar)\
**Post date:** [January 9, 2024, 1:51pm UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/1 "2024-01-09T13:51:41Z")

</div>

Hello,

I would like to run two cameras in two different processes. Unfortunately, the ZED SDK throws in the program part

```auto
if status != sl.ERROR_CODE.SUCCESS:
    log(LogLevel.ERROR, repr(status))
    print(repr(status))
    exit()

```

the following error

`NO GPU DETECTED`

It looks like the problem has been going on for a while:

> [@ZED X (gmsl) Not working with python multiprocessing](https://community.stereolabs.com/t/zed-x-gmsl-not-working-with-python-multiprocessing/2883/4):
>
> Any news about this?

Are there any ideas on how to solve the problem or when a bug fix will come?

Edit:  
I work on pyzed 4.0 and two ZED2i

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [January 9, 2024, 2:00pm UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/3 "2024-01-09T14:00:40Z")

</div>

Hi @Phyrokar  
can you provide more details regarding your configuration and an example of code to replicate this behavior?

---

<div class="post-metadata">

**Author:** ![system](https://community.stereolabs.com/uploads/default/original/2X/7/703c26fe16845a046a5c896e226e5f728ea313a0.svg) [@system](https://community.stereolabs.com/u/system)\
**Post date:** [January 9, 2024, 2:00pm UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/4 "2024-01-09T14:00:51Z")

</div>

Hi @Phyrokar  
can you provide more details regarding your configuration and an example of code to replicate this behavior?

[Discourse post]

Walter

**Walter Lucetti**  
_Senior Computer Engineer_  
SDK / Robotics / HW  
Stereolabs Support

---

<div class="post-metadata">

**Author:** ![geyang](https://community.stereolabs.com/user_avatar/community.stereolabs.com/geyang/32/2387_2.png) [@geyang](https://community.stereolabs.com/u/geyang)\
**Post date:** [January 9, 2024, 7:23pm UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/5 "2024-01-09T19:23:28Z")

</div>

The pyzed SDK does not work with the python multiprocess.Process class. This has been recorded before, but never solved.

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [January 10, 2024, 10:08am UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/6 "2024-01-10T10:08:43Z")

</div>

The Team has not yet found a working solution to this problem that only seems to affect ZED X cameras.  
We are working hard to fix it and a solution will be provided as soon as possible.

---

<div class="post-metadata">

**Author:** ![Phyrokar](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/p/3bc359/32.png) [@Phyrokar](https://community.stereolabs.com/u/Phyrokar)\
**Post date:** [January 17, 2024, 8:18am UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/7 "2024-01-17T08:18:32Z")

</div>

Hello, I found a workaround for me.

Thank you

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [January 17, 2024, 9:09am UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/8 "2024-01-17T09:09:29Z")

</div>

@PhyrokarIf the information is suitable for public sharing, please do so as it may benefit others in the community.

---

<div class="post-metadata">

**Author:** ![Phyrokar](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/p/3bc359/32.png) [@Phyrokar](https://community.stereolabs.com/u/Phyrokar)\
**Post date:** [January 17, 2024, 9:19am UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/9 "2024-01-17T09:19:03Z")

</div>

I changed the start method from multiprocessing in the main method to spawn:

`mp.set_start_method('spawn', force=True)`

Since ZED objects are not pickleable, I created two processes for the respective cameras that communicate via c\_variables. With torch.multiprocessing you can also exchange images as tensors across processes.

Note: I work on two ZED2i cameras. So the problem regarding ZEDX is not solved.

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [January 17, 2024, 9:20am UTC](https://community.stereolabs.com/t/python-multiprocessing-bug-fix/4310/10 "2024-01-17T09:20:39Z")

</div>

@Phyrokar Thank you for the helpful information.
