Strange Behavior of Multiprocess Manager Ignoring Rest of Code Block

It turns out Manager has a problem with tensorflow.

To make sure Manager is instantiated before doing anything with tensorflow, move every code related to tensorflow into a funcion, including the imports.
Then call the funcion in the if __name__ == "__main__":.

def launchAgent():
    from stable_baselines import DQN
    import Reinforcement_AI.env.seperate_env as sep_env
    from queue import Queue
    from threading import Thread

    #tf related code
    ...

if __name__ == "__main__":
    from Image_Processing.image_processing import runIP
    from multiprocessing import Manager

    print("TRYING TO CREATE MANAGER")
    manager = Manager()
    print("CREATED MANAGER")
    runIP(manager)
    launchAgent()

This solved my issue.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top