ID 482280 - Exceptions when starting the `KQD` script due to third-party library conflicts via `PYTHONPATH`

Follow

Problem summary:

When Katana 4.0v5 is started in an environment where PYTHONPATH points to a Python installation that contains zmq or PyQt5 libraries that conflict with Katana's versions of those libraries, the KQD Python process fails to launch during Katana application startup due to Python exceptions being raised. This then results in the Katana Queue being unavailable for rendering in that Katana session.

Steps to reproduce:

  1. Install Katana 3.1v1 and Katana 4.0v5.
  2. In your Katana 4.0v5 launch environment, set PYTHONPATH to point to the Python directory of the Katana 3.1v1 installation, e.g.
    • 
      $ export PYTHONPATH=/usr/local/foundry/Katana3.1v1/bin/python/
  3. Launch Katana 4.0v5, e.g.
    • 
      $ cd /usr/local/foundry/Katana4.0v5$ ./katana
  4. Check the terminal for error messages regarding the KQD script Python process.
  5. In the Node Graph tab, create a CameraCreate node, and start a Katana Queue > Preview Render from it. 

Expected behaviour:

The KQD script Python process launches successfully.

The Preview Render on Katana Queue starts and completes successfully.

Actual behaviour:

Error messages are printed to the console during application startup:

In case of a conflicting zmq library, error messages like the following might be printed:


/usr/local/foundry/Katana3.1v1/bin/python/zmq/backend/cffi/__pycache__/_cffi_ext.c:269:17: fatal error: zmq.h: No such file or directory #include <zmq.h>                 ^compilation terminated.Traceback (most recent call last):  File "Plugins/kq/KQD.py", line 23, in <module>  File "/usr/local/foundry/Katana3.1v1/bin/python/zmq/__init__.py", line 34, in <module>    from zmq import backend  File "/usr/local/foundry/Katana3.1v1/bin/python/zmq/backend/__init__.py", line 40, in <module>    reraise(*exc_info)  File "/usr/local/foundry/Katana3.1v1/bin/python/zmq/backend/__init__.py", line 27, in <module>    _ns = select_backend(first)  File "/usr/local/foundry/Katana3.1v1/bin/python/zmq/backend/select.py", line 26, in select_backend    mod = __import__(name, fromlist=public_api)  File "/usr/local/foundry/Katana3.1v1/bin/python/zmq/backend/cython/__init__.py", line 6, in <module>    from . import (constants, error, message, context,ImportError: /usr/local/foundry/Katana3.1v1/bin/python/zmq/backend/cython/error.so: undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE

In case of a conflicting PyQt5 library, an exception traceback like the following might be printed:


Traceback (most recent call last):  File "Plugins/kq/KQD.py", line 26, in <module>  File "Plugins/kq/__init__.py", line 16, in <module>  File "Plugins/kq/Messages/__init__.py", line 7, in <module>  File "Plugins/kq/Messages/Push.py", line 13, in <module>  File "Plugins/kq/Util/__init__.py", line 7, in <module>  File "Plugins/kq/Util/Timing.py", line 12, in <module>ImportError: /path/to/Katana4.0v5/bin/libQt5Core.so.5: version `Qt_5.9' not found (required by /usr/lib64/python2.7/site-packages/PyQt5/QtCore.so)

Attempting to start a Preview Render of the CameraCreate node via the Katana Queue fails, with lines like the following written to the render log:


3D Render: CameraCreateStart Time: Thu Jul  1 19:54:59 2021Layers / Views: primary.mainFrame: 1Completed writing scene graph description.Render error. Time elapsed: 0.01 sNode 'CameraCreate': Failed to submit job to render farm

Workaround:

Create a file named init.py with the following contents in a folder named Startup in a directory whose path is added to KATANA_RESOURCES:


import osif 'PYTHONPATH' in os.environ:    originalPythonPath = os.environ['PYTHONPATH']    internalPythonPath = os.environ['KATANA_INTERNAL_PYTHONPATH']    os.environ['PYTHONPATH'] = internalPythonPath    import kq    kq.StartQueue()    os.environ['PYTHONPATH'] = originalPythonPath

Tested versions/platforms:

  • 4.0v1 - Unaffected
  • 4.0v2 - Unaffected
  • 4.0v3 - Unaffected
  • 4.0v4 - Unaffected
  • 4.0v5 - Affected

Customer version/platform:

4.0v5/Linux

    We're sorry to hear that

    Please tell us why