AWS Thinkbox Discussion Forums

Monitor ignores PYTHONPATH

I find it hard to believe, but apparently the Monitor now completely ignores the PYTHONPATH from its containing environment. Can someone explain the reasoning there?

If I remember right, we compiled all of DPython to ignore it. It was to avoid flighting when running inside of apps that set their own fancy PYTHONPATHs. Specifically so we wouldn’t die on conflicting versions of PyQt.

Jon’s suggested workaround to me was to configure your site:
docs.python.org/2/library/site. … .USER_SITE

I would like to request that this be changed by converting it to an “opt-in” behavior at runtime. In other words, by default, all applications would pick up the PYTHONPATH from the parent environment, but there would be a command-line flag that would tell the application to ignore PYTHONPATH.

I don’t consider USER_SITE an acceptable workaround. The whole point of PYTHONPATH is to be able to set up the module search path before a program is launched. In our case, we use a package management system to set up shell environments with combinations of requested packages, and this system is used extensively to both launch applications from a shell environment, and to spawn subprocesses from within other processes. Making a special exception, .pth file, etc. just for Deadline applications is more trouble than its worth.

Yeah, the issue we had run into in the past is that PyQt is popular enough that it’s not unlikely for it to already by in the PYTHONPATH, which screwed up Deadline.

The ‘correct’ fix for this would be to not rely on the site-packages of our embedded Python to find PyQt, and instead just prefix sys.path with its location, but I don’t think that’s happening for 8.0.

The flag isn’t hard-coded in Python as Edwin seemed to suggest though, so it should be very straightforward and low-risk for us to expose a flag to disable this behavior.

Cheers,
Jon

Just wanted to see if this made it into Deadline 9 (either in the form of proper PYTHONPATH support, or at least a flag to enable it).

Yup. We are no longer ignoring PYTHONPATH, and are instead explicitly prefixing our internal folders to sys.path.

Great! Thanks Jon.

Privacy | Site terms | Cookie preferences