AWS Thinkbox Discussion Forums

Mangled deadline python build version name

Hi, We just upgraded to 10.1.15 and we are now seeing this error:

>  File "C:\Program Files\Thinkbox\Deadline10\bin\Lib\platform.py", line 1453, in python_implementation
> 2021-06-07 10:30:12:      return _sys_version()[0]
> 2021-06-07 10:30:12:    File "C:\Program Files\Thinkbox\Deadline10\bin\Lib\platform.py", line 1418, in _sys_version
> 2021-06-07 10:30:12:      repr(sys_version))
> 2021-06-07 10:30:12:  ValueError: failed to parse CPython sys.version: '2.7.13 | packaged by Thinkbox Software | (default, Apr  5 2021, 17:01:50) [MSC v.1926 64 bit (AMD64)]'

Looks like you changed the version label of the interpreter and it broke plaftorm._sys_version() …

Can you confirm this behavior on your side ? What can we do about it ?
Thx

1 Like

For now I can patch the version manually before calling anything that might parse it

    import sys
    sys.version = '2.7.13 (default, Apr  5 2021, 17:01:50 packaged by Thinkbox Software) [MSC v.1926 64 bit (AMD64)'

It works, but it is pretty dirty …

Was just about to post since I hit the same issue. Here’s what I found and how I resolved it personally for us:

Deadline 10.1.15.2 breaks Python platform package for GlobalJobPreLoad.py

It seems since a recent update of Deadline the Python interpreter used to run GlobalJobPreLoad.py has broken the core Python platform package due to a change in the version string of the Python interpreter (sys.version).

Version details:

Version: v10.1.15.2 Release (313fe6482)
Operating System: Windows 10 Pro

Error log:

Error: Global job preload script 'C:\ProgramData\Thinkbox\Deadline10\workers\machine\plugins\60c0e472d5ea80111de5b984\GlobalJobPreLoad.py': ValueError : failed to parse CPython sys.version: '2.7.13 | packaged by Thinkbox Software | (default, Apr  5 2021, 17:01:50) [MSC v.1926 64 bit (AMD64)]' (FranticX.Scripting.PythonNetException)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\machine\plugins\60c0e472d5ea80111de5b984\GlobalJobPreLoad.py", line 122, in __main__
    env = get_project_asset_env_overrides(env)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\machine\plugins\60c0e472d5ea80111de5b984\GlobalJobPreLoad.py", line 39, in get_project_asset_env_overrides
    import avalon.io as io
  File "P:/pipeline/2.1_dev/git/avalon-core\avalon\io.py", line 17, in <module>
    import pymongo
  File "/path/to\pymongo\__init__.py", line 81, in <module>
    from pymongo.mongo_client import MongoClient
  File "/path/to\pymongo\mongo_client.py", line 54, in <module>
    from pymongo.client_options import ClientOptions
  File "/path/to\pymongo\client_options.py", line 24, in <module>
    from pymongo.pool import PoolOptions
  File "/path/to\pymongo\pool.py", line 240, in <module>
    if platform.python_implementation().startswith('PyPy'):
  File "C:\Program Files\Thinkbox\Deadline10\bin\Lib\platform.py", line 1453, in python_implementation
    return _sys_version()[0]
  File "C:\Program Files\Thinkbox\Deadline10\bin\Lib\platform.py", line 1418, in _sys_version
    repr(sys_version))
   at Python.Runtime.PyObject.Invoke(PyObject[] args)
   at Python.Runtime.PyObject.InvokeMethod(String name, PyObject[] args)
   at FranticX.Scripting.PythonNetScriptEngine.CallFunction(String moduleName, String functionName, Object[] args)
   at Deadline.Plugins.PluginWrapper.d()
   at Deadline.Plugins.PluginWrapper.StartJob(String& outMessage, AbortLevel& abortLevel)

This in particular comes from us importing pymongo which however fails on platform.python_implementation() which fails on platform._sys_version() basically because sys.version returns: 2.7.13 | packaged by Thinkbox Software | (default, Apr 5 2021, 17:01:50) [MSC v.1926 64 bit (AMD64)].

Where did this change come from and why? :slight_smile:

For now I monkeypatched platform in our GlobalJobPreLoad.py

# Monkeypatch the running Python's `platform._sys_version` which fails
# by default with the Python packaged with Deadline. Since Pymongo
# uses `platform.python_implementation` it won't work without this fix.
import platform
try:
    platform._sys_version()
except ValueError as exc:
    if "failed to parse CPython sys.version" in str(exc):
        # Monkeypatch the error
        print("Monkeypatching platform._sys_version in GlobalJobPreLoad.py")
        original_fn = platform._sys_version
        def _sys_version_patched(sys_version=None):
            try:
                original_fn(sys_version=sys_version)
            except ValueError as exc:
                # Strip the packaged by Thinkbox Software information which
                # is causing the `platform` library regex to fail
                if sys_version is None:
                    sys_version = sys.version
                
                sys_version = sys_version.replace(" | packaged by Thinkbox Software |", "")
                return original_fn(sys_version=sys_version)
                
        platform._sys_version = _sys_version_patched
    else:
        raise

Note that this is a very hacky monkey patch kind of like of what @alexisp wrote here. :slight_smile:

Still it seems to be quite a breaking issue if a core library like platform in Python is broken for this Python interpreter?

3 Likes

Any news on this front ?
This is a real annoyance, we have 100+ licences we renew every year, some support would be appreciated…

1 Like

You may wanna raise a ticket instead.

https://awsthinkbox.zendesk.com/hc/en-us

1 Like

Hi guys,

After going back and forth with Thinkbox support I think the issue is only present on workers that auto-upgraded from 10.0 to 10.1 and some files where not copied/updated correctly

Manually overwriting the C:\Program Files\Thinkbox\Deadline10\bin\Lib\platform.py on defective workers seemed to have solved the issue.

This is not the first time we encounter issues with files not being copied or updated through deadline master “auto-upgrade” so beware of it !

1 Like
Privacy | Site terms | Cookie preferences