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

uv venv does not create a lib64 directory #3578

Closed
AtomBaf opened this issue May 14, 2024 · 4 comments · Fixed by #3584
Closed

uv venv does not create a lib64 directory #3578

AtomBaf opened this issue May 14, 2024 · 4 comments · Fixed by #3584
Assignees
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool

Comments

@AtomBaf
Copy link

AtomBaf commented May 14, 2024

Context

Platform: linux rocky 9
uv version: 0.1.42

Error when importing torch

uv venv foobar
source foobar/bin/activate
uv pip install torch
python -c "import torch"
> ImportError: libcudnn.so.8: cannot open shared object file: No such file or directory

Investigation

After investigation I discovered that:

  • uv venv foobar does not create a lib64 directory under the venv directory
  • installing pytorch will create a lib64 directory with some libraries (nvidia*) inside it
  • in fact there will be some libraries in lib and some other in lib64
  • this lib64 is part of the sys.path , however, it seems not used during the import of torch thus leading to the error above
  • with a similar python -m venv foobar , I noticed that the lib64 directory is created as a symlink to the lib directory
  • indeed, after uv venv, when manually symlinking, everything is fine
@charliermarsh
Copy link
Member

Does virtualenv do this? I suspect the distro is patching the venv module. I'm not sure how we could know the create the symlink here.

@henryiii
Copy link
Contributor

henryiii commented May 14, 2024

This is https://github.com/python/cpython/blob/b228655c227b2ca298a8ffac44d14ce3d22f6faa/Lib/venv/__init__.py#L135-L140 (basically, it's always created on 64-bit non-OS X POSIX)

@charliermarsh
Copy link
Member

Lol thank you. Will fix.

@charliermarsh charliermarsh self-assigned this May 14, 2024
@charliermarsh charliermarsh added bug Something isn't working compatibility Compatibility with a specification or another tool labels May 14, 2024
@konstin
Copy link
Member

konstin commented May 14, 2024

virtualenv .venv --no-seed (or with seed) doesn't create lib64 for me (ubuntu 24.04 x86_64), python -m venv does:

.venv
├── bin
│   ├── activate
│   ├── activate.csh
│   ├── activate.fish
│   ├── activate.nu
│   ├── activate.ps1
│   ├── activate_this.py
│   ├── python -> /home/konsti/.pyenv/versions/3.12.3/bin/python3.12
│   ├── python3 -> python
│   └── python3.12 -> python
├── lib
│   └── python3.12
│       └── site-packages
│           ├── _virtualenv.pth
│           └── _virtualenv.py
└── pyvenv.cfg

5 directories, 12 files

charliermarsh added a commit that referenced this issue May 14, 2024
## Summary

Closes
#3578 (comment).

## Test Plan

Verified that in the OpenSUSE test, we create both, and they're
symlinks:

```text
INFO: Creating virtual environment with `venv`...
INFO: Installing into `venv` virtual environment...
DEBUG Found a virtualenv named .venv at: /tmp/tmp4nape29h/.venv
DEBUG Cached interpreter info for Python 3.10.14, skipping probing: .venv/bin/python
DEBUG Using Python 3.10.14 environment at .venv/bin/python
DEBUG Trying to lock if free: .venv/.lock
purelib: "/tmp/tmp4nape29h/.venv/lib/python3.10/site-packages"
platlib: "/tmp/tmp4nape29h/.venv/lib64/python3.10/site-packages"
is_same_file(purelib, platlib): Ok(true)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants