pyinstaller / pyinstaller-hooks-contrib

Community maintained hooks for PyInstaller.
Other
96 stars 126 forks source link

Fix issues with run-time discovery of collected CUDA/cuDNN libraries on linux #786

Closed rokm closed 3 months ago

rokm commented 3 months ago

Fix issues with run-time discovery of collected CUDA/cuDNN libraries on linux when using torch and/or tensorflow.

Use the symlink suppression mechanism from https://github.com/pyinstaller/pyinstaller/pull/8761 to suppress creation of top-level directory symlinks for libtensorflow_cc.so.2, libtensorflow_framework.so.2, and _pywrap_tensorflow_internal.so from tensorflow package. These symlinks cause tensorflow to mis-identify its location, and cause it to search for CUDA libraries in wrong directories. See https://github.com/pyinstaller/pyinstaller-hooks-contrib/pull/676#issuecomment-1866440960

For a very similar reason, suppress top-level directory symlink creation for all shared libraries from nvidia.cu* packages to fix Unable to load any of {libcudnn_engines_precompiled.so.9.1.0, libcudnn_engines_precompiled.so.9.1, libcudnn_engines_precompiled.so.9, libcudnn_engines_precompiled.so} and RuntimeError: CUDNN_BACKEND_TENSOR_DESCRIPTOR cudnnFinalize failed cudnn_status: CUDNN_STATUS_NOT_INITIALIZED errors when trying to use ultralytics package with torch-based model. See https://github.com/pyinstaller/pyinstaller/issues/8758

Add a hook for ultralytics package to ensure that its config .yaml files are collected (and collect source .py files in case a JIT-based model is used).