Skip to content

python3Packages.llama-cpp-python: disable removeStubsFromRunpathHook to fix import when cudaSupport is enabled#468659

Closed
GaetanLepage wants to merge 1 commit intoNixOS:masterfrom
GaetanLepage:llama-cpp-python
Closed

python3Packages.llama-cpp-python: disable removeStubsFromRunpathHook to fix import when cudaSupport is enabled#468659
GaetanLepage wants to merge 1 commit intoNixOS:masterfrom
GaetanLepage:llama-cpp-python

Conversation

@GaetanLepage
Copy link
Contributor

@GaetanLepage GaetanLepage commented Dec 7, 2025

Things done

Better alternative to #465751.
This fixes all reverse dependencies.

Ideally, we would need a cleaner toggle to disable removeStubsFromRunpathHook.

cc @ConnorBaker @SomeoneSerge

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot requested review from booxter and kirillrdy December 7, 2025 12:08
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 6.topic: python Python is a high-level, general-purpose programming language. labels Dec 7, 2025
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. and removed 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Dec 7, 2025
@GaetanLepage
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 468659 --extra-nixpkgs-config '{ allowUnfree = true; cudaSupport = true; }'
Commit: c8cb3ca5f3d163e32fd3de4c3dc7574a79cfddb6


x86_64-linux

✅ 25 packages built:
  • nixpkgs-manual
  • python312Packages.kserve
  • python312Packages.kserve.dist
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python312Packages.outlines
  • python312Packages.outlines.dist
  • python312Packages.torchrl
  • python312Packages.torchrl.dist
  • vllm (python312Packages.vllm)
  • vllm.dist (python312Packages.vllm.dist)
  • python313Packages.kserve
  • python313Packages.kserve.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist
  • python313Packages.outlines
  • python313Packages.outlines.dist
  • python313Packages.torchrl
  • python313Packages.torchrl.dist
  • python313Packages.vllm
  • python313Packages.vllm.dist

aarch64-linux

✅ 9 packages built:
  • nixpkgs-manual
  • python312Packages.llama-cpp-python
  • python312Packages.llama-cpp-python.dist
  • python312Packages.llm-gguf
  • python312Packages.llm-gguf.dist
  • python313Packages.llama-cpp-python
  • python313Packages.llama-cpp-python.dist
  • python313Packages.llm-gguf
  • python313Packages.llm-gguf.dist

@ConnorBaker
Copy link
Contributor

IMHO this is the wrong approach.

References to stubs should never be present in runtime binaries because they cannot and will not work. At best other runpath entries supply the full library before the stub is tried. At worst (think non-NixOS, libraries which don’t link against the driver but need the driver, or when we need to use cuda_compat) the stub file is loaded and tracking down the runtime failure becomes much more difficult.

The root of the problem is that importing the module immediately tries to dlopen a library — that should be lazy.

By disabling the hook, all that happens is that the module succeeds in immediately dlopening a library (which it shouldn’t do) corresponding to a stub library (which will never work and shouldn’t be in the closure).

@GaetanLepage
Copy link
Contributor Author

I applied the same process as in #465751 to outlines in #471697.

I'll be closing this PR.

@GaetanLepage GaetanLepage deleted the llama-cpp-python branch December 29, 2025 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants