Skip to content

python3Packages.torchWithCuda: lazy loading nvrtc #296179

Open

Description

@SomeoneSerge

Describe the bug

Pytorch uses dlopen to load libnvrtc.so without publicly declaring a dependency on it: https://github.com/pytorch/pytorch/blob/014f91a9d9f94ac9a7f0711600240d7cd7f69844/aten/src/ATen/cuda/detail/LazyNVRTC.cpp#L78-L83. No declaration -> no runpaths preserved after installation -> dlopen fails.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix run github:SomeoneSerge/dust3r.nix/cf159ccbab05b6b023b8f5050572adfa21b30a34#pretrained;
  2. open the web page;
  3. feed 2+ images;
  4. Observe a runtime error
  File "/nix/store/c64592rcivfc0w373nfh41j9lshb0w3s-python3.11-roma-unstable-2024-02-26/lib/python3.11/site-packages/roma/mappings.py", line 77, in procrustes
    R, DS = _ProcrustesManualDerivatives.apply(M, force_rotation, regularization, gradient_eps)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/n33zdaqxa8j711plws8xyjpzdnw0idmr-python3.11-torch-2.2.1/lib/python3.11/site-packages/torch/autograd/function.py", line 553, in apply
    return super().apply(*args, **kwargs)  # type: ignore[misc]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/c64592rcivfc0w373nfh41j9lshb0w3s-python3.11-roma-unstable-2024-02-26/lib/python3.11/site-packages/roma/mappings.py", line 22, in forward
    flip = (torch.det(U) * torch.det(V) < 0)
    ^^^^^^^^^^^^
RuntimeError: Error in dlopen for library libnvrtc.so.12and libnvrtc-26bfb51d.so.12

Additional context

Add any other context about the problem here.

Notify maintainers

@NixOS/cuda-maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a 👍 reaction to issues you find important.

Activity

  1. added
    0.kind: bug
    6.topic: python
    6.topic: cuda
    on Mar 15, 2024
  2. hoh commented on Mar 29, 2024

    @hoh
    Member

    I am facing the same issue when using transformers, thanks for looking into this !

  3. SomeoneSerge commented on Mar 29, 2024

    @SomeoneSerge
    ContributorAuthor

    I am facing the same issue when using transformers, thanks for looking into this !

    You can already use the version in the PR: I just need to rewrite because I broke some jetson-related stuff. Alternatively, the overlay in SomeoneSerge/dust3r.nix@8715f78 should work too

  4. added
    2.status: stale
    on Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug2.status: stale6.topic: cuda6.topic: python

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions