Python failed import from click.core in Houdini 20

Openpype Addon: 3.18.7
Deadline Addon: 0.1.19
Houdini Addon: 0.2.11

Heya, this suddenly cropped up both when opening Houdini 20 through Ayon and when running Houdini 20 jobs in deadline.

In this error I had removed the Ynput from the deadline user’s local app data to guarantee a fresh install.

Error
STDOUT: Installing AYON ...
STDOUT: Setting scene FPS to 25
STDOUT: Updated $JOB to Y:/TestAyon/BJ0003_Ayon_SGCreated_Test/SGC/0010/work/Layout
STDOUT: Could not initialize the help server:
STDOUT: Traceback (most recent call last):
STDOUT:   File "<stdin>", line 1, in <module>
STDOUT:   File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.547/houdini/python3.10libs\houdinihelp\api.py", line 126, in initialize
STDOUT:     bookish_app = get_houdini_app(use_houdini_path=bool(hou))
STDOUT:   File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.547/houdini/python3.10libs\houdinihelp\server.py", line 25, in get_houdini_app
STDOUT:     from bookish import flaskapp, flasksupport
STDOUT:   File "C:\Program Files\Side Effects Software\Houdini 20.0.547\python310\lib\site-packages-forced\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
STDOUT:     return original_import(name, *args, **kwargs)
STDOUT:   File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.547/houdini/python3.10libs\bookish\flaskapp.py", line 37, in <module>
STDOUT:     import flask
STDOUT:   File "C:\Program Files\Side Effects Software\Houdini 20.0.547\python310\lib\site-packages-forced\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
STDOUT:     return original_import(name, *args, **kwargs)
STDOUT:   File "C:\PROGRA~1\SIDEEF~1\HOUDIN~1.547\python310\lib\site-packages\flask\__init__.py", line 2, in <module>
STDOUT:     from .app import Flask as Flask
STDOUT:   File "C:\Program Files\Side Effects Software\Houdini 20.0.547\python310\lib\site-packages-forced\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
STDOUT:     return original_import(name, *args, **kwargs)
STDOUT:   File "C:\PROGRA~1\SIDEEF~1\HOUDIN~1.547\python310\lib\site-packages\flask\app.py", line 34, in <module>
STDOUT:     from . import cli
STDOUT:   File "C:\Program Files\Side Effects Software\Houdini 20.0.547\python310\lib\site-packages-forced\shiboken2\files.dir\shibokensupport\__feature__.py", line 142, in _import
STDOUT:     return original_import(name, *args, **kwargs)
STDOUT:   File "C:\PROGRA~1\SIDEEF~1\HOUDIN~1.547\python310\lib\site-packages\flask\cli.py", line 15, in <module>
STDOUT:     from click.core import ParameterSource

-----------------------------------------------------

FailRenderException : Error: cannot import name 'ParameterSource' from 'click.core' (C:\Users\deadline\AppData\Local\Ynput\AYON\addons\openpype_3.18.7\openpype\vendor\python\python_2\click\core.py)
   at Deadline.Plugins.DeadlinePlugin.FailRender(String message) (Python.Runtime.PythonException)
  File "C:\ProgramData\Thinkbox\Deadline10\workers\WOOD\plugins\661dcb898ac7a89d74e5fc20\Houdini.py", line 412, in HandleStdoutError
    self.FailRender(self.GetRegexMatch(1))
   at Python.Runtime.Dispatcher.Dispatch(ArrayList args)
   at __FranticX_Processes_ManagedProcess_StdoutHandlerDelegateDispatcher.Invoke()
   at FranticX.Processes.ManagedProcess.RegexHandlerCallback.CallFunction()
   at FranticX.Processes.ManagedProcess.e(String di, Boolean dj)
   at FranticX.Processes.ManagedProcess.Execute(Boolean waitForExit)
   at Deadline.Plugins.DeadlinePlugin.DoRenderTasks()
   at Deadline.Plugins.PluginWrapper.RenderTasks(Task task, String& outMessage, AbortLevel& abortLevel)
   at Deadline.Plugins.PluginWrapper.RenderTasks(Task task, String& outMessage, AbortLevel& abortLevel)

This is a known issue I believe - there’s some conflict in versions between AYON dependencies and those from Houdini.

The easiest “workaround” is to prepend the Houdini python dependencies to the python path for Houdini 20 application variant in settings.

{
    "HOUDINI_VERSION": "20.0.590",
    "PYTHONPATH": [
        "C:/Program Files/Side Effects Software/Houdini {HOUDINI_VERSION}/python310/lib/site-packages",
        "{PYTHONPATH}"
    ]
}

Note how I’m forcing the Houdini python packages to the beginning of PYTHONPATH so those are enforced to be prioritized over the AYON ones.

3 Likes

Thank you @BigRoy , this helped me for OpenPype as well.
In case anyone was finding this issue in OpenPype 3.14, you will most likely need to add the following file in case it doesn’t exist yet:

.\OpenPype\openpype\hosts\houdini\startup\python3.10libs\pythonrc.py

# -*- coding: utf-8 -*-
"""OpenPype startup script."""
from openpype.pipeline import install_host
from openpype.hosts.houdini.api import HoudiniHost


def main():
    print("Installing OpenPype ...")
    install_host(HoudiniHost())


main()
1 Like

Thanks for reporting.

You will indeed need a \python3.xxlibs\pythonrc.py file matching the Python version used by Houdini, so if a future version uses 3.11 likely we’ll then need a similar copy in AYON for 3.11 (but then the AYON code equivalent)…

For completeness sake, Houdini 20.5 is Python 3.11 so this last comment is very relevant. However it should be implemented in ayon-houdini since Support Houdini 20.5+ with Py3.11 by BigRoy · Pull Request #3 · ynput/ayon-houdini · GitHub so :white_check_mark:

1 Like