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\", 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\", 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 ?

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 breaks Python platform package for

It seems since a recent update of Deadline the Python interpreter used to run 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\': 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\", line 122, in __main__
    env = get_project_asset_env_overrides(env)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\machine\plugins\60c0e472d5ea80111de5b984\", line 39, in get_project_asset_env_overrides
    import as io
  File "P:/pipeline/2.1_dev/git/avalon-core\avalon\", line 17, in <module>
    import pymongo
  File "/path/to\pymongo\", line 81, in <module>
    from pymongo.mongo_client import MongoClient
  File "/path/to\pymongo\", line 54, in <module>
    from pymongo.client_options import ClientOptions
  File "/path/to\pymongo\", line 24, in <module>
    from pymongo.pool import PoolOptions
  File "/path/to\pymongo\", line 240, in <module>
    if platform.python_implementation().startswith('PyPy'):
  File "C:\Program Files\Thinkbox\Deadline10\bin\Lib\", line 1453, in python_implementation
    return _sys_version()[0]
  File "C:\Program Files\Thinkbox\Deadline10\bin\Lib\", line 1418, in _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

# 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
except ValueError as exc:
    if "failed to parse CPython sys.version" in str(exc):
        # Monkeypatch the error
        print("Monkeypatching platform._sys_version in")
        original_fn = platform._sys_version
        def _sys_version_patched(sys_version=None):
            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

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?


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.

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\ 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