Skip to content

Conda installation detailed instructions #73

Closed

Description

@NasonZ

I'm trying to follow the instructions for installing unsloth in a conda environment, the problem is that the conda gets stuck when running the install lines.

I've tried running it twice, both times it got stuck solving the environment and I stopped after 30 minutes.

$ conda install cudatoolkit xformers bitsandbytes pytorch pytorch-cuda=12.1 -c pytorch -c nvidia -c xformers -c conda-forge -y
Collecting package metadata (current_repodata.json): \ WARNING conda.models.version:get_matcher(546): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.7.1.*, but conda is ignoring the .* and treating it as 1.7.1
done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): - WARNING conda.models.version:get_matcher(546): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.8.0.*, but conda is ignoring the .* and treating it as 1.8.0
WARNING conda.models.version:get_matcher(546): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.9.0.*, but conda is ignoring the .* and treating it as 1.9.0
WARNING conda.models.version:get_matcher(546): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.6.0.*, but conda is ignoring the .* and treating it as 1.6.0
done
Solving environment: | 

Additional system info:

$ nvidia-smi
Mon Jan  8 20:28:55 2024       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.129.03             Driver Version: 535.129.03   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA A10G                    Off | 00000000:00:1E.0 Off |                    0 |
|  0%   28C    P8              16W / 300W |      4MiB / 23028MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+

Activity

  1. danielhanchen commented on Jan 9, 2024

    @danielhanchen
    Member

    Do you have mamba?

    Maybe try mamba install cudatoolkit xformers bitsandbytes pytorch pytorch-cuda=12.1 -c pytorch -c nvidia -c xformers -c conda-forge -y

  2. danielhanchen commented on Jan 9, 2024

    @danielhanchen
    Member

    Mamba can help solve long solving issues

  3. NasonZ commented on Jan 9, 2024

    @NasonZ
    Author

    No, I have a miniconda/anaconda which was installed via oobabooga.

    (base) ubuntu@awsec2:~$ conda activate model_train_env
    (model_train_env) ubuntu@awsec2:~$ mamba install cudatoolkit xformers bitsandbytes pytorch pytorch-cuda=12.1 -c pytorch -c nvidia -c xformers -c conda-forge -y
    Command 'mamba' not found, did you mean:
      command 'samba' from deb samba (2:4.15.13+dfsg-0ubuntu1.5)
    Try: sudo apt install <deb name>
    
  4. danielhanchen commented on Jan 10, 2024

    @danielhanchen
    Member

    @NasonZ hmmmm another approach is to install it one by one and ignoring pytorch

    conda install cudatoolkit xformers bitsandbytes -c nvidia -c xformers -c conda-forge
    
  5. NasonZ commented on Jan 10, 2024

    @NasonZ
    Author

    TLDR:

    These are the steps I took to get my unsloth conda env working

    $ conda create --name <your_unsloth_env> python=<3.10/3.9>
    
    $ conda install pytorch torchvision torchaudio pytorch-cuda=<12.1/11.8> -c pytorch -c nvidia
    
    $ conda install xformers -c xformers -y
    
    $ pip install bitsandbytes
    
    $ pip install "unsloth[conda] @ git+https://github.com/unslothai/unsloth.git"
    

    So I tried installing one by one which raised I few issues which I was able to work around.

    1. xformers needs python 3.9 or 3.10 (I had 3.11 as it wasn't specified what python version was needed in the readme.md)
    (model_train_env) ubuntu@awsec2:~/dmyzer/dmyzer-data-generator$ conda install xformers -c xformers -y        
    Collecting package metadata (current_repodata.json): done                                                             
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.                                  
    Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.           
    Collecting package metadata (repodata.json): done                                                                     
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.                                  
    Solving environment: -                                                                                                
    Found conflicts! Looking for incompatible packages.                                                                   
    This can take several minutes.  Press CTRL-C to abort.                                                                
    failed                                                                                                                
                                                                                                                          
    UnsatisfiableError: The following specifications were found                                                           
    to be incompatible with the existing python installation in your environment:                                         
                          
    Specifications:
    
      - xformers -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0']
    
    Your python: python=3.11
    
    If python is on the left-most side of the chain, that's the version you've asked for.
    When python appears to the right, that indicates that the thing on the left is somehow
    not available for the python version you are constrained to. Note that conda will not
    change your python version to a different minor version unless you explicitly specify
    that.
    
    The following specifications were found to be incompatible with your system:
    
      - feature:/linux-64::__cuda==12.2=0
      - feature:/linux-64::__glibc==2.35=0
      - feature:|@/linux-64::__glibc==2.35=0
      - python=3.11 -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
      - xformers -> pytorch=2.0.1 -> __cuda[version='>=11.8']
    
    Your installed version is: 2.35
    
    1. Installing cudatoolkit separately led to issues when installing pytorch after, cudatoolkit is installed by pytorch-cuda so specifying it separately was redundant in my case.

    2. Installing bitsandbytes via conda install bitsandbytes -c conda-forge -y led to the same frozen solve issue outlined originally. Installing via conda install conda-forge::bitsandbytes also didn't work, bitsandbytes threw a load of errors when running from unsloth import FastLanguageModel. Eventually got it running by installing the method mentioned in the bitsandbytes repo - pip install bitsandbytes.

    I verified that my enviornment was working by running the TinyLLama notebook.

  6. danielhanchen commented on Jan 10, 2024

    @danielhanchen
    Member

    Oh my! Thanks so so much for the detailed instructions - I'll be pinning this if you don't mind :) Glad it finnaly was able to work!!

  7. changed the title [-]Conda install stuck[/-] [+]Conda installation detailed instructions[/+] on Jan 10, 2024
  8. NasonZ commented on Jan 10, 2024

    @NasonZ
    Author

    No worries, happy to help other get onboard with what looks to be a really useful package :)

  9. findalexli commented on Feb 8, 2024

    @findalexli

    hi there, still getting the following error: Could not solve for environment specs
    The following packages are incompatible
    └─ xformers is installable with the potential options
    ├─ xformers [0.0.16|0.0.17|...|0.0.24] would require
    │ └─ python >=3.10,<3.11.0a0 , which can be installed;
    ├─ xformers [0.0.16|0.0.17|...|0.0.24] would require
    │ └─ python >=3.9,<3.10.0a0 , which can be installed;
    └─ xformers [0.0.16|0.0.20|0.0.21] conflicts with any installable versions previously reported. When running (unsloth) (base) ubuntu@ip-172-31-34-94:~$ mamba install cudatoolkit xformers bitsandbytes pytorch pytorch-cuda=12.1 -c pytorch -c nvidia -c xformers -c conda-forge -y, I checked that I have coda 12.1 installed

  10. Gene-Weaver commented on Mar 14, 2024

    @Gene-Weaver

    I ran into this error:

    Exception has occurred: RuntimeError
    
            CUDA Setup failed despite GPU being available. Please run the following command to get more information:
    
            python -m bitsandbytes

    And used this combination of the approaches listed above to get things working:

    conda create --name unsloth_env python=3.10
    conda activate unsloth_env
    mamba install xformers pytorch pytorch-cuda=12.1 -c pytorch -c nvidia -c xformers -c conda-forge -y
    pip install bitsandbytes
    pip install "unsloth[conda] @ git+https://github.com/unslothai/unsloth.git"

  11. felipepenhorate commented on Mar 15, 2024

    @felipepenhorate

    Just a heads up to anyone that is trying to install the package on a miniconda env and getting error in the xformers installation because of conflicts, it turns out nowadays the conda is installing pytorch==2.2.1 that is not compatible with the xformers. You need to set the pytorch version to 2.2.0 in order to make the installation work properly.

    This is what I used:

    conda create --name unsloth_env python=3.10
    conda activate unsloth_env
    conda install pytorch==2.2.0 cudatoolkit torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
    conda install xformers -c xformers
    pip install bitsandbytes
    pip install "unsloth[conda] @ git+https://github.com/unslothai/unsloth.git"
    
  12. NasonZ commented on Mar 15, 2024

    @NasonZ
    Author

    @felipepenhorate Thanks for the quick fix, just encountered this issue with conda.

  13. unpinned this issue on Mar 15, 2024
  14. 11 remaining items

  15. ArrangingFear56 commented on Jul 14, 2024

    @ArrangingFear56

    @WasamiKirua
    Are you running windows? If so, you may need to run it in WSL 2 instead, that’s what eventually worked for me.

  16. richardxoldman commented on Jul 16, 2024

    @richardxoldman
    conda create --name unsloth_env python=3.10
    conda activate unsloth_env
    conda install pytorch==2.2.0 cudatoolkit torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
    pip install xformers==0.0.24
    pip install bitsandbytes
    pip install "unsloth[conda] @ git+https://github.com/unslothai/unsloth.git"
    

    It works for me (Linux)

  17. danielhanchen commented on Jul 18, 2024

    @danielhanchen
    Member

    Apologies on Conda issues - I do know sometimes it can be painful - another option is to copy paste our Kaggle install instructions here: https://www.kaggle.com/danielhanchen/kaggle-gemma2-9b-unsloth-notebook which might work

  18. SeaQuestdev commented on Aug 17, 2024

    @SeaQuestdev

    On Windows this works only on WSL"?

  19. ArrangingFear56 commented on Aug 17, 2024

    @ArrangingFear56

    On Windows this works only on WSL"?

    In my experience, yes. There would be unresolvable dependencies otherwise.

  20. SeaQuestdev commented on Aug 17, 2024

    @SeaQuestdev

    Thanks @ArrangingFear56 Will try later in WSL. Currently fine tuning in colab.

  21. danielhanchen commented on Aug 24, 2024

    @danielhanchen
    Member
  22. OFouda1 commented on Aug 28, 2024

    @OFouda1

    @NasonZ Thanks Thanks Thanks

  23. unpinned this issue on Sep 30, 2024
  24. mohamednaji7 commented on Dec 15, 2024

    @mohamednaji7

    @NasonZ Thanks a lot; I downloaded it on RunPod

    $ conda create --name <your_unsloth_env> python=3.10

    $ conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

  25. added a commit that references this issue on Jun 8, 2025
  26. added a commit that references this issue on Jun 25, 2025
  27. added a commit that references this issue on Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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