R24.111: shiboken2 fails to load (Win10)

At our facility we have PySide2 installed for python 3.9, which of course includes the shiboken2 package. However, for some reason it fails to load in either c4dpy.exe or the python console (in the C4D application). It loads just fine in the python.exe that ships with C4D R24.

ImportError: DLL load failed while importing shiboken2: The specified module could not be found.

Why might this be happening and how can we fix this? Our pipeline tools are all PySide/PySide2 based and they work without problems inside older versions of C4D such as R18, R19, R20, R21.

(And yes, the location of shiboken2 is in sys.path, as evidenced by the fact that other modules at the same level as shiboken2 import without problems.)

Hello @jcooper,

thank you for reaching out to us. First of all, I must point out that what you are trying to do is out of scope of support. We cannot support third party libraries as stated in our Forum Guidelines and we especially cannot support third party GUIs.

The little help I can give you here is to say:

  1. There is currently a bug in R25 which will cause faulty installations when using pip and having a vanilla CPython installation of the same version on the system. The installation itself will work fine, but the import paths of both Pythons will become entangled in this case due CPython having some hardcoded import paths in its code pointing to the user directories. We have fixed this problem and the fix will be delivered with an upcoming release. You can check this easily by checking the installation paths of modules with the ```fileattribute of the module. When you are encountering the problem, it will be pointing towards yourCPython`` site-packages and not the
    one from Cinema. There is not much what you can do to fix this yourself (aside from monkey-patching our Python yourself).
  2. There is more than sys.path in Python, there is also sys.meta_path and relative imports, so just being able to import other packages in the same path is no guarantee that everything is fine.

I cannot say much more with the given little information, and we can unfortunately also not support third party libraries. You should check if indeed is everything installed in the correct location. The problem you have could be related to what I describe under 1., but that bug did exist for quite some time, so it should have failed before.

Cheers,
Ferdinand

Hi, @jcooper , did you solve this problem? We also have a pipeline built on PySide2