Repository navigation
Description
Description
Hi there! 👋 I'm running into a bit of a headache with Unsloth and CUDA compatibility. Despite following the official installation instructions for CUDA 11.8, my system keeps telling me the NVIDIA driver is too old and CUDA is unavailable. I'd really appreciate some help figuring this out!
Environment
- OS: Linux (Ubuntu)
- Python version: 3.11.11
- NVIDIA driver version: 520.56.06
- CUDA version on system: 11.8
- GPU model: NVIDIA GeForce RTX 3090 (24GB VRAM)
- Unsloth version: 2025.4.7
- PyTorch version: 2.6.0+cu124 (installed by Unsloth)
Expected behavior
Unsloth should use the available GPU with CUDA 11.8 support as specified in the installation command.
Actual behavior
PyTorch reports that the NVIDIA driver is too old and CUDA is unavailable:
UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 11080). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx
When running the training script, Unsloth exits with:
NotImplementedError: Unsloth: No NVIDIA GPU found? Unsloth currently only supports GPUs!
Steps to reproduce
- Created a new conda environment with the official command:
conda create --name unsloth_env \
python=3.11 \
pytorch-cuda=11.8 \
pytorch cudatoolkit xformers -c pytorch -c nvidia -c xformers \
-y
conda activate unsloth_env
pip install unsloth- Installed required dependencies
- When running training script, received the CUDA error
What I've tried so far
- Verified that NVIDIA driver (520.56.06) supports CUDA 11.8
- Confirmed GPU is detected by
nvidia-smi - Checked that conda installation included the correct CUDA packages
- Ran diagnostics to verify the issue is due to PyTorch's CUDA version mismatch
Additional information
The issue appears to be that Unsloth's pip installation overrides the conda-installed PyTorch (with CUDA 11.8) with a newer PyTorch version that requires CUDA 12.4. Despite specifying pytorch-cuda=11.8 in the conda environment, running pip install unsloth installs torch-2.6.0+cu124 which is incompatible with the system driver.
I think this might be a dependency management quirk where Unsloth really wants specific versions of PyTorch that need newer CUDA versions than what I have available. Any suggestions on how to make Unsloth work with my current setup would be super helpful! Thanks in advance! 🙏
Activity
rolandtannous commentedon May 9, 2025
@ctongh
Some of the core packages required by unsloth, require a newer version of torch like 2.6.0 or newer.
You can't really work around this without break the package.
One example is xformers. Latest xformers version 0.0.30 requires torch==2.7.0
In your case:
-update your driver versions and install system wide cuda-toolkit from here: https://developer.nvidia.com/cuda-12-4-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_network
Make sure to pick the correct ubuntu version you have 20.04 vs 22.04
conda install -c "nvidia/label/cuda-12.4.131" cuda-toolkitpip install git+https://github.com/unslothai/unsloth-zoo.gitpip install git+https://github.com/unslothai/unsloth.gitpip install bitsandbytes datasets huggingface_hub hf_transferFollow install from source section using
setup.py installas explained here https://github.com/Dao-AILab/flash-attention?tab=readme-ov-file#installation-and-featuresYou should be good to go.
If you have some other package that requires cuda-11.8, what you can do is create a separate conda environment for it and install cuda toolkit 11.8 inside that specific environment .
Hope this helps.
Oleg777778 commentedon May 9, 2025
It feels like Unsloth is impossible to install properly. I've been struggling with this for over a month now. First, I tried all three installation methods on Windows, and now I’m trying on Linux—but nothing works, despite putting in a ridiculous amount of time and effort. Below are the results of my Linux attempts. I’ve tried everything at this point. What am I doing wrong?
Hardware Configuration:
Software Environment:
Full Error Reproduction:
python -c "from unsloth import FastLanguageModel; model, tokenizer = FastLanguageModel.from_pretrained('unsloth/mistral-7b-bnb-4bit', load_in_4bit=True)"Error:
a) Disabling xformers:
XFORMERS_DISABLED=1 python -c "..."[Same error]
b) Manual xformers install:
pip install xformers==0.0.25[Creates version conflicts]
c) Barebones test:
python -c "from unsloth import FastLanguageModel; print('Import works')"[Success, but generation fails]
Key Error Logs:
Main generation failure:
Traceback (most recent call last):
Current Status:
Request:
Need either:
rolandtannous commentedon May 9, 2025
@Oleg777778
Sorry to hear about your frustration . I can see why it's potentially not working.
Please update your GPU driver to at least cu550.
Then follow exactly the steps I provided above to install unsloth in an environment. Your current approach is the cause of several issues. Make sure to install cuda toolkit > 12.4 following the steps i provided. Don't pre-install torch,let unsloth-zoo install it. Don't force an xformers version.
Also that attn_bias error you are getting is because you potentially need to install flash attention. Follow step4.
notlu commentedon May 10, 2025
I met with the same issue.
rolandtannous commentedon May 10, 2025
@notlu follow the 4 steps in a new environment as detailed at the bottom of this reply:
#2499 (comment)
your cuda driver has to be up to date. the cuda toolkit version should be >=12.4
ctongh commentedon May 12, 2025
Hi @rolandtannous @Oleg777778 ,Thank you all for your quick responses! These solutions will be incredibly helpful for others who encounter similar issues and find this thread.
In my specific situation, we have multiple servers in our lab, and some of them are running older CUDA versions (like 11.8). Since I'm not the server administrator, I don't have permission to update the GPU drivers or CUDA versions on these machines.
I'm wondering if there's a way to use an earlier version of unsloth that would be compatible with older GPU drivers and CUDA versions. Currently, when trying to install a specific version through pip, I can only go back as far as version 2024.8 (but I likely need an even earlier version like 2023.8 to work with my setup).
If it could make earlier versions available, that would be extremely convenient. Of course, I understand that with models constantly evolving, it makes sense that unsloth only provides relatively recent versions.
Thanks again for your help!
rolandtannous commentedon May 12, 2025
@ctongh unfortunately, I don't think that's currently possible. I am also afraid you'll lose a lot of functionality that has been added in the latest versions of unsloth and all its dependencies.
The best way forward is explain to your IT admin the situation , and request they update the CUDA version at least on the workstation you're using, or just on all servers. They shouldn't mind.
Oleg777778 commentedon May 12, 2025
@rolandtannous, I want to sincerely thank you for your guidance! Your advice on driver updates and CUDA 12.4 installation was instrumental in finally getting Unsloth to work locally after a month of dependency struggles. The model now runs flawlessly for inference — truly a breakthrough!
Remaining Hurdle: Flash Attention Compilation Hang
Despite Unsloth’s functionality, installing flash-attn freezes during compilation. Here’s the detailed breakdown:
System Configuration:
OS: Fresh Ubuntu 24.04 install
GPU: RTX 4060 Ti 16GB (Driver 550.54.15)
CUDA: 12.4 (via
conda install -c "nvidia/label/cuda-12.4.131" cuda-toolkit)Hardware: Ryzen 5 1600X, 64GB RAM
Reproduction Steps:
Observed Behavior:
Compilation hangs indefinitely (tested for 2+ hours) with:
Building wheel for flash-attn (setup.py) ... /"top" shows sustained 100% CPU usage on 2 cores by gcc/nvcc without progress.
Forced termination (Ctrl+C) reveals:
cicc: error while loading shared libraries: libtinfo.so.6: cannot open shared object fileAttempted Solutions:
✔ Installed libtinfo6 and libncurses5 (no effect)
✔ Limited threads: MAX_JOBS=2 pip install flash-attn
✔ Pre-built packages:
pip install flash-attn --no-build-isolation --no-deps✔ Manual compilation from FlashAttention repo
Key Questions:
Current Workaround:
Using "FastLanguageModel.disable_xFormers = True", but hoping to unlock full performance with Flash Attention.
Your expertise would be invaluable—this is the last major blocker! Many thanks in advance for any insights.
rolandtannous commentedon May 12, 2025
@Oleg777778
steps
Oleg777778 commentedon May 14, 2025
@rolandtannous,
thank you very much for your help. It works properly at last!
FA [Xformers = None. FA2 = True]rolandtannous commentedon May 14, 2025
Great to know. I'll close this for now.
Please feel free to re-open it if you feel you have to.
arnabwithab commentedon Jun 18, 2025
@rolandtannous
im getting the same error, however I've completed all the steps as you had previously mentioned
I even downgraded to a cuda 12.4 to no avail
rolandtannous commentedon Jun 18, 2025
@Eros483 that was mostly applicable to linux system.
For windows support:
Unsloth Studio: tokenize in process when the trainer is too big in ho…