Job PYTHONPATH can cause "Could not initialize the plugin sandbox"

If you’re getting the rather frustrating…
Failed to load the plugin because: Could not initialize the plugin sandbox

Maybe have a look and see if your job properties has a custom PYTHONPATH set in the environment tab. We have this for passing PYTHONPATHs to 3dsmax, but with max2022 we’re passing py3.7 paths and deadline is running 2.7 and failing because it’s trying to load some module from our py3.7 path.

We changed PYTHONPATH to MAX_PYTHONPATH and edited 3dsmax.py to pass that through to the process PYTHONPATH for max.

Hope this helps, didn’t find anything googling related to this.

1 Like

Thanks for this. Note that newer Deadlines run python 3, so your issue might just go away by upgrading.
Also, I suspect there might be more detailed logs on the workers.

We’d then run into an opposite problem though. We’re still running 3dsmax 2018 as well which would then pass a py2.7 PYTHONPATH to deadlineworker.exe.

I checked all the logs, there wasn’t anything useful for debugging this, and ran with processMon too which still didn’t help reveal much.

Note that you completely control the subprocess’s environment, so you can just change whatever is needed in 3dsmax’s process. For example, you can use deadlinePlugin.SetProcessEnvironmentVariable.

Yeah that’s what I’ve changed things to now, but it maaaay be worth adding a warning in somewhere in deadline to say… hey setting PYTHONPATH in job env properties can clash with deadline’s pythonpath… or maybe deadline should handle PYTHONPATH uniquely?

When you start dpython.exe it has a default path set up. My observation is that the default path is wrong.
But in subprocesses you will always have the issue of environment, so you’re better of managing it explicitly in the plugin.