Skip to content

PermissionError when bitsandbytes scans system path /var/lib/gitea/libcudart.so #1711

@RewaaHummedi

Description

@RewaaHummedi

System Info

System Info:

  • OS: Ubuntu
  • CUDA version: 11.8
  • PyTorch: 2.1.2
  • bitsandbytes: 0.41.1 (built from source)
  • Used inside a Conda environment
  • Model: Unsloth gemma-3-12b-it in 4-bit mode

Reproduction

Hi, I'm encountering a PermissionError during import due to bitsandbytes trying to scan a restricted system path for CUDA libraries:

PermissionError: [Errno 13] Permission denied: '/var/lib/gitea/libcudart.so'
This happens during the execution of:

from unsloth.chat_templates import get_chat_template
import bitsandbytes

Even after setting LD_LIBRARY_PATH and CUDA_HOME, and reinstalling bitsandbytes==0.41.1 from source using --no-binary, the issue persists.
Since the library scans all entries in os.environ, it hits unreadable directories like /var/lib/gitea, which causes the crash.

Expected behavior

This is breaking inference workflows even when bitsandbytes is built locally. Please advise on a proper patch or ignore logic for unreadable system paths.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions