-
Notifications
You must be signed in to change notification settings - Fork 668
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
Permission denied error in cuda_setup when any env var contains /root path #675
Comments
@ignasgr #620 seems to be a similar issue in that bitsandbytes cuda_setup checks for existence of a file in a careless way that can trigger PermissionError exceptions. But it's happening in a different place in the code, so my suggested fix in PR #677 will most likely not fix that problem. But I think applying PR #622 would fix it. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. |
Thanks again for the fix! |
My setup
Linux, Python 3.10.8, CUDA 12,
pip install bitsandbytes==0.41.0
This is a Slurm cluster and there is an environment variable like this:
The problem
Running
python -m bitsandbytes
fails with a permisison error. It appears thatbitsandbytes
decides to check if the path/root
containslibcudart.so
because this path appears in an environment variable.Note that my
LD_LIBRARY_PATH
contains the real path to the CUDA libraries. cuda_setup does find them, but it doesn't stop there; instead it goes on to check all kinds of other random environment variables, includingSLURM_SUBMIT_DIR
in my situation, in case they also happen to contain CUDA libraries, and then stumbles on the permission error when it can't read files under/root
. FWIW, I think this is also a logic error (it should stop when it finds the CUDA libraries usingLD_LIBRARY_PATH
and look no further) but that's beyond the scope of this report.How to replicate
LD_LIBRARY_PATH
pip install bitsandbytes==0.41.0
export MY_RANDOM_ENV_VAR=/root
python -m bitsandbytes
Related issues/PRs
How to fix
This is fairly simple to fix, just need to wrap the
is_file
check in atry ... except
block that checks forPermissionError
, here: https://github.com/TimDettmers/bitsandbytes/blob/18e827d666fa2b70a12d539ccedc17aa51b2c97c/bitsandbytes/cuda_setup/main.py#L217I will open a PR with the suggested fix shortly.
The text was updated successfully, but these errors were encountered: