Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Some packages rely on site-packages layout #274

Closed
alexeagle opened this issue Feb 26, 2024 · 4 comments · Fixed by #275
Closed

[Bug]: Some packages rely on site-packages layout #274

alexeagle opened this issue Feb 26, 2024 · 4 comments · Fixed by #275
Labels
bug Something isn't working

Comments

@alexeagle
Copy link
Member

What happened?

rules_py doesn't really create a standard pip install-style site-packages folder currently, rather it creates a .pth file and expects packages to "do the right thing".

This plays badly with loading shared objects in particular, such as

Error: /main.runfiles/pip_deps_nvidia_cudnn_cu11/site-packages/nvidia/cublas/lib/libcublas.so.11: cannot open shared object file: No such file or directory
# But that file libcublass.so.11 exists in a different external package:
./main.runfiles/pip_deps_nvidia_cublas_cu11/site-packages/nvidia/cublas/lib/libcublas.so.11

Version

HEAD

How to reproduce

No response

Any other information?

No response

@alexeagle alexeagle added the bug Something isn't working label Feb 26, 2024
@github-actions github-actions bot added the untriaged Requires traige label Feb 26, 2024
@siddharthab
Copy link
Contributor

I gave some thought to it, and I think making a symlink forest inside the venv will be the right way to do this.

@alexeagle
Copy link
Member Author

Yes, and it's very similar to what @thesayyn has been working on in rules_oci where those symlinks point outside of that folder to other entries in bazel-out - we'll get his help to fix this.

@siddharthab
Copy link
Contributor

I threw together something in a PR because my team needed it sooner. Please feel free to reject it.

@alexeagle
Copy link
Member Author

@mattem could you take a look at that PR?

@alexeagle alexeagle removed the untriaged Requires traige label Mar 6, 2024
mattem pushed a commit that referenced this issue Mar 30, 2024
This emulates the behavior where a single site-packages directory
contains all/most PyPi packages. Packages distributed by NVIDIA
currently assume this through the use of rpath as `$ORIGIN/../../`
to reach the `nvidia` package location. Downstream libraries like torch
and jax do not set up the dynamic library search path based on sys.path
either.

Fixes #274.

---------

Co-authored-by: Matt Mackay <[email protected]>
@github-project-automation github-project-automation bot moved this to ✅ Done in Open Source Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants