diff --git a/backend/build_binary.py b/backend/build_binary.py index 2df2ceb2..875d6733 100644 --- a/backend/build_binary.py +++ b/backend/build_binary.py @@ -55,20 +55,23 @@ def build_server(cuda=False): # numpy 2.x / torch ABI mismatch fix: install memmove fallback for # torch.from_numpy() before the app starts. Runtime hooks run after # FrozenImporter is registered so frozen torch/numpy are importable. + # Paths are passed relative to backend_dir because os.chdir(backend_dir) + # runs before PyInstaller. Absolute paths would get baked into the + # generated .spec, breaking reproducible builds on other machines / CI. args.extend( [ "--runtime-hook", - str(backend_dir / "pyi_rth_numpy_compat.py"), + "pyi_rth_numpy_compat.py", # Stub torch.compiler.disable before transformers imports # flex_attention, which otherwise triggers torch._dynamo → # torch._numpy._ufuncs and crashes at module load under # PyInstaller. See pyi_rth_torch_compiler_disable.py. "--runtime-hook", - str(backend_dir / "pyi_rth_torch_compiler_disable.py"), + "pyi_rth_torch_compiler_disable.py", # Per-module collection overrides (e.g. forcing scipy.stats._distn_infrastructure # to bundle .py source alongside .pyc so the runtime hook can source-patch it). "--additional-hooks-dir", - str(backend_dir / "pyi_hooks"), + "pyi_hooks", ] ) diff --git a/backend/voicebox-server.spec b/backend/voicebox-server.spec index 4f7f49b7..ab8566c8 100644 --- a/backend/voicebox-server.spec +++ b/backend/voicebox-server.spec @@ -58,9 +58,9 @@ a = Analysis( binaries=binaries, datas=datas, hiddenimports=hiddenimports, - hookspath=['/Users/jamie/Projects/spacedriveapp/voicebox/backend/pyi_hooks'], + hookspath=['pyi_hooks'], hooksconfig={}, - runtime_hooks=['/Users/jamie/Projects/spacedriveapp/voicebox/backend/pyi_rth_numpy_compat.py', '/Users/jamie/Projects/spacedriveapp/voicebox/backend/pyi_rth_torch_compiler_disable.py'], + runtime_hooks=['pyi_rth_numpy_compat.py', 'pyi_rth_torch_compiler_disable.py'], excludes=['nvidia', 'nvidia.cublas', 'nvidia.cuda_cupti', 'nvidia.cuda_nvrtc', 'nvidia.cuda_runtime', 'nvidia.cudnn', 'nvidia.cufft', 'nvidia.curand', 'nvidia.cusolver', 'nvidia.cusparse', 'nvidia.nccl', 'nvidia.nvjitlink', 'nvidia.nvtx'], noarchive=False, optimize=0,