• Multiprocessing "Process" cannot find Luxonis.

Select the tag above (via "Choose tag"). If you need help from Luxonis, select "Support".

Hi All!
Just following up on this (we originally chatted on Discord).

I recently found out that running the Luxonis in a Python multiprocessing.Process means that on a raspberry PI and a jetson, the luxonis cannot be found. I had to move it to the main Process (and put other processes into a multiprocessing.Process).

Just thought i'd share this since I looked for quite a while to solve this.

Jack (Loving the Luxonis stuff!!!).

23 days later

jakaskerl Hey Jakaskerl - would you have any suggestions on how to fix this problem? I've got it working without running the the Luxonis in a Process. it makes me think that for some reason the USB permissions are not being shared from Parent to Child properly.
Any advice?
Thanks!! Jack

    jakaskerl Hey Jakaskerl! Thanks for the reply mate. I really appreciate it.
    Yep I can. Don't have my hands on an RPI right at this second but I will get back to you either tomorrow or the next day.
    I'll try recreate it using ur rbg camera example.
    For what it's worth, here's whats causing the error for me (only in docker on the RPI or Jetson).

    def main():
        # We start both of these processes within the same file since neither can be pickled properly.
        args = parseArgs()
        config = ELEServerConfig(args)
    
        luxonisPipelineQueue = multiprocessing.Queue()
    
        if not config.disableLuxonis:
            luxonisPipelineProcess = multiprocessing.Process(
                target=startLuxonisPipeline,
                args=(config, luxonisPipelineQueue),
            )
            luxonisPipelineProcess.start()

    Then the startLuxonisPipeline is pretty standard.

       def start(self):
            print("### STARTING LUXONIS ###")
    
            with dai.Device(self.pipeline) as device:
                if self.config.debug:
                    device.setLogLevel(dai.LogLevel.DEBUG)
                    device.setLogOutputLevel(dai.LogLevel.DEBUG)
                device.startPipeline()
                frameSynchroniser = FrameSynchroniser(len(enabledPipelineStreams))
                dataCollector = DataCollector(config=self.config)
            
                # Do some stuff with queues etc.
    a year later

    I wonder if there is a recommendation for this. Running into the same issue on an NVIDA Orin AGX.

    Hi @BenjaminKiefer
    No, the python multiprocessing doesn't work with the library. Any chance you can start another interpreter or just run it in multithreading?

    Thanks,
    Jaka

    Thx for the reply @Jackmarks!

    Oddly enough, it is running on my x86 Windows machine. Just not on the Orin AGX. Do you know why?

    Another interpreter is not an option, and multithreading is not efficient enough for my purpose (object detection on host with big detector, tracking, …).

    I could run the cam process as the main process and have the other processes as child processes, right?

      6 days later

      Hi @BenjaminKiefer
      It's interesting setup works on your x86 Windows machine but not on the Orin AGX. Might be due to differences in how USB devices are managed between the operating systems, or possibly differences in how multiprocessing interacts with USB access on different platforms.

      BenjaminKiefer I could run the cam process as the main process and have the other processes as child processes, right?

      Yeah that should work I think. As long as the usb handling (dai.Device) isn't run on a separate process.

      Thanks,
      Jaka