Repository navigation
Closed
Description
I followed the conda installation instructions in the README:
conda create --name unsloth_env python=3.10
conda activate unsloth_env
conda install pytorch 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"
There were no issues during the install. However, when I try to import from unsloth, I get an error.
from unsloth import FastLanguageModelResults in an error:
/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/site-packages/bitsandbytes/cextension.py:34: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
warn("The installed version of bitsandbytes was compiled without GPU support. "
/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so: undefined symbol: cadam32bit_grad_fp32
/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/site-packages/unsloth/__init__.py:71: UserWarning: Unsloth: Running `ldconfig /usr/lib64-nvidia` to link CUDA.
warnings.warn(
/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
Traceback (most recent call last):
File "/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/site-packages/unsloth/__init__.py", line 68, in <module>
cdequantize_blockwise_fp32 = bnb.functional.lib.cdequantize_blockwise_fp32
File "/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/ctypes/__init__.py", line 387, in __getattr__
func = self.__getitem__(name)
File "/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so: undefined symbol: cdequantize_blockwise_fp32
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/site-packages/unsloth/__init__.py", line 99, in <module>
cdequantize_blockwise_fp32 = bnb.functional.lib.cdequantize_blockwise_fp32
File "/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/ctypes/__init__.py", line 387, in __getattr__
func = self.__getitem__(name)
File "/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so: undefined symbol: cdequantize_blockwise_fp32
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/miniconda/envs/unsloth_env/lib/python3.10/site-packages/unsloth/__init__.py", line 102, in <module>
raise ImportError("Unsloth: CUDA is not linked properly.\n"\
ImportError: Unsloth: CUDA is not linked properly.
We tried running `ldconfig /usr/lib64-nvidia` ourselves, but it didn't work.
You need to run in your terminal `sudo ldconfig /usr/lib64-nvidia` yourself, then import Unsloth.
Also try `sudo ldconfig /usr/local/cuda-xx.x` - find the latest cuda version.I looked for both /usr/lib64-nvidia and files matching /usr/local/cuda-* but found none.
I have the NVIDIA driver installed fine for cuda=12.2. Here is the output of my nvidia-smi command:
Tue Mar 5 01:23:41 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.161.07 Driver Version: 535.161.07 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 Tesla T4 Off | 00000000:00:1B.0 Off | 0 |
| N/A 27C P0 24W / 70W | 2MiB / 15360MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
| 1 Tesla T4 Off | 00000000:00:1C.0 Off | 0 |
| N/A 27C P0 25W / 70W | 2MiB / 15360MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
| 2 Tesla T4 Off | 00000000:00:1D.0 Off | 0 |
| N/A 27C P0 24W / 70W | 2MiB / 15360MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
| 3 Tesla T4 Off | 00000000:00:1E.0 Off | 0 |
| N/A 28C P0 25W / 70W | 2MiB / 15360MiB | 6% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| No running processes found |
+---------------------------------------------------------------------------------------+
I'm running Ubuntu 22.04.3 on an AWS EC2 g4dn.12xlarge which has T4 GPUs.
Reacted by Drew Thomasson
Metadata
Metadata
Assignees
Labels
No labels
Activity
danielhanchen commentedon Mar 5, 2024
Sorry on the issue :(
There is another way to install it if this works (Also first check if
mambaworks in the terminal, since it makes installing faster by reducing solving time :))If that doesn't work, also try folding in xformers:
athoag-sony commentedon Mar 5, 2024
Hi, thanks for the response. The first suggestion did not work. The second did at least change the error:
I will look into this a bit more, but if you have seen this before and know what to do please let me know.
I did notice that if installed xformers after pytorch-cuda, it changed my pytorch version to one that was not cuda-compatible:
But this seems to be solved by folding in the xformers installation into the conda install command as you suggested.
j-d-salinger commentedon Mar 5, 2024
I have the same issue... This "folding-in" sort of worked for me... When I try to install it says 'no module name triton found'... If i run pip3 install triton, I get a linking error again
danielhanchen commentedon Mar 5, 2024
@j-d-salinger For triton - oh my there's no triton during the pytorch install? Maybe add an update flag to Conda.
@athoag-sony Hmm bitsandbytes issues :( I might have to open a large thread in BnB - installing from source might be the only other option for now - I'll see what I can do
j-d-salinger commentedon Mar 5, 2024
Thanks!! i was able to get a functional bitsandbytes by building from source. Or at least, i no longer get a warning that it was compiled iwthout GPU support.
I thought that would solve it, but there is still an ldconfig error...
athoag-sony commentedon Mar 5, 2024
I was able to get bitsandbytes to import by using
python=3.11instead ofpython=3.10. However, now when I try to import from unsloth I get:Here are the steps to reproduce:
If I then try to install triton with conda:
I get a new error when I try to import from unsloth:
danielhanchen commentedon Mar 6, 2024
@j-d-salinger Can you run
python -m bitsandbytesandpython -m xformers.infoin a terminal and paste ur output here@athoag-sony Can you import triton manually and check its version by
import triton; triton.__version__It probably means thats an old version. Another approach is to usepipdirectly:pip install tritonAgain apologies on the install issues - sadly Triton and BnB can be quite annoying to install
avacaondata commentedon Mar 12, 2024
I'm having a similar error; tried to use the steps above and install bitsandbytes from source but still:
@danielhanchen How can I install unsloth properly?
avacaondata commentedon Mar 12, 2024
xformers info:
output of bitsandbytes:
danielhanchen commentedon Mar 12, 2024
@avacaondata Hmm there is another approach which might or might not work:
This is a nightly build so I'm still working on it - it might or might not work.
avacaondata commentedon Mar 12, 2024
Ok thanks @danielhanchen that seems to solve the past issue, but now I have another one, I think related to triton:
danielhanchen commentedon Mar 12, 2024
@avacaondata wait are u on WSL / Linux?
avacaondata commentedon Mar 12, 2024
Yes I'm on WSL with Ubuntu 20, is that a problem for unsloth to work? @danielhanchen
matthewdouglas commentedon Mar 13, 2024
@avacaondata You'll want to
sudo apt install build-essentialand if you have the same problem, tryexport CC=/usr/bin/gcc(make sure that's the right path).For those issues with BNB, I'd like to know if it is with the
0.43.0release or a prior one, as the build/distribution pipeline has had some changes for 0.43.0. It should find the libraries that came distributed with PyTorch, but there's some situations where it may not (e.g. other CUDA toolkit versions installed, environment settings likeLD_LOAD_LIBRARY,PATH, etc. I'm planning to continue contributing over there to make this more seamless.avacaondata commentedon Mar 13, 2024
@matthewdouglas Thanks you! ❤️ At least the error changed:
However that's strange because with normal QLoRA it works, without using the unsloth wrapper. Moreover, I'm checking the GPU memory and at no point it goes above 15GB.
8 remaining items
danielhanchen commentedon Mar 16, 2024
@athoag-sony I'll work on something to make it faster, but it's generally checking for all the necessary packages to see if they work :)
danielhanchen commentedon Mar 20, 2024
@avacaondata I forgot to ask if you had Pytorch 2.2.0 or 2.2.1? If you do, I updated Unsloth to reduce memory VRAM fragmentation which might be the issue of OOMs - although I'm not sure. It can sometimes reduce VRAM usage by 3GB!!
socallme commentedon Apr 6, 2024
I've just tried this but still get the same error. Have tried recreating the conda env with no success.
++++++++++++++++++ BUG REPORT INFORMATION ++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++ ANACONDA CUDA PATHS ++++++++++++++++++++
['/home/anon/miniconda3/envs/unsloth_env/lib/libcudart.so']
++++++++++++++++++ /usr/local CUDA PATHS +++++++++++++++++++
[]
+++++++++++++++ WORKING DIRECTORY CUDA PATHS +++++++++++++++
[]
++ LD_LIBRARY_PATH /usr/local/cuda-12.4/lib64 CUDA PATHS +++
['/usr/local/cuda-12.4/lib64/stubs/libcuda.so']
++++++++++++++++++++++++++ OTHER +++++++++++++++++++++++++++
COMPILED_WITH_CUDA = True
COMPUTE_CAPABILITIES_PER_GPU = ['8.6']
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++ DEBUG INFO END ++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Checking that the library is importable and CUDA is callable...
WARNING: Please be sure to sanitize sensitive info from any such env vars!
SUCCESS!
Installation was successful!
Unable to find python bindings at /usr/local/dcgm/bindings/python3. No data will be captured.
xFormers 0.0.24+cu118
memory_efficient_attention.cutlassF: available
memory_efficient_attention.cutlassB: available
memory_efficient_attention.decoderF: available
[email protected]: available
[email protected]: available
memory_efficient_attention.smallkF: available
memory_efficient_attention.smallkB: available
memory_efficient_attention.tritonflashattF: unavailable
memory_efficient_attention.tritonflashattB: unavailable
memory_efficient_attention.triton_splitKF: available
indexing.scaled_index_addF: available
indexing.scaled_index_addB: available
indexing.index_select: available
sequence_parallel_fused.write_values: unavailable
sequence_parallel_fused.wait_values: unavailable
sequence_parallel_fused.cuda_memset_32b_async: unavailable
sp24.sparse24_sparsify_both_ways: available
sp24.sparse24_apply: available
sp24.sparse24_apply_dense_output: available
sp24._sparse24_gemm: available
[email protected]: available
swiglu.dual_gemm_silu: available
swiglu.gemm_fused_operand_sum: available
swiglu.fused.p.cpp: available
is_triton_available: True
pytorch.version: 2.2.0+cu121
pytorch.cuda: available
gpu.compute_capability: 8.6
gpu.name: NVIDIA GeForce RTX 3090
dcgm_profiler: unavailable
build.info: available
build.cuda_version: 1108
build.python_version: 3.10.13
build.torch_version: 2.2.0+cu118
build.env.TORCH_CUDA_ARCH_LIST: 5.0+PTX 6.0 6.1 7.0 7.5 8.0+PTX 9.0
build.env.XFORMERS_BUILD_TYPE: Release
build.env.XFORMERS_ENABLE_DEBUG_ASSERTIONS: None
build.env.NVCC_FLAGS: None
build.env.XFORMERS_PACKAGE_FROM: wheel-v0.0.24
build.nvcc_version: 11.8.89
source.privacy: open source
danielhanchen commentedon Apr 6, 2024
@socallme We have new install instructions for that!
socallme commentedon Apr 7, 2024
@danielhanchen I have tried those instructions with the same result. There are never any errors or warnings when installing either.
/usr/local/lib/python3.10/dist-packages/unsloth/init.py:72: UserWarning: Unsloth: Running
ldconfig /usr/lib64-nvidiato link CUDA.warnings.warn(
/usr/local/lib/python3.10/dist-packages/unsloth/init.py:103: UserWarning: Unsloth: CUDA is not linked properly.
danielhanchen commentedon Apr 7, 2024
@socallme Are you using conda? Can you try running
nvccin the terminal andnvidia-smisocallme commentedon Apr 9, 2024
@danielhanchen I am using conda. Are there links I need to manually make?
I am able to run other tools without issue in conda, eg axolotl, llamacpp
nvcc and nvidia-smi:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:18:24_PDT_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.15 Driver Version: 550.54.15 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| 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 GeForce RTX 3090 Off | 00000000:04:00.0 On | N/A |
| 70% 75C P2 298W / 300W | 21862MiB / 24576MiB | 97% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 788204 C python 21856MiB |
+-----------------------------------------------------------------------------------------+
tdolega commentedon May 14, 2024
@socallme did you managed to fix the issue? I have the same problem.
danielhanchen commentedon May 17, 2024
@tdolega Oh no :( Conda correct? It's actually best to follow Kaggle's install method ie
mzeidhassan commentedon Aug 27, 2024
I have been trying for almost 6 hours to install all requirements, but each time I fix something, another breaks. Unsloth installation, especially on Windows, is a nightmare.
danielhanchen commentedon Aug 27, 2024
@mzeidhassan Oh sorry :( Oh yep Windows is a nightmare - it's Triton that's causing the issue.
Another issue is to use miniconda and conda and install through Windows (not pip)
shimmyshimmer commentedon Jan 19, 2025
We have docs which might be able to help, if you're still experiencing errors please let us know: https://docs.unsloth.ai/get-started/installing-+-updating
We're also gonna make Windows downloading much easier hopefully pretty soon!
rolandtannous commentedon May 9, 2025
@athoag-sony
Hello!
I would suggest you try the following approach:
conda create --name unsloth_new python==3.11conda activate unsloth_newconda install -c "nvidia/label/cuda-12.6.3” cuda-toolkitpip installor directly from main repo using
pip install --force-reinstall git+https://github.com/unslothai/unsloth-zoo.gitandpip install --force-reinstall git+https://github.com/unslothai/unsloth.gitpip install bitsandbytes datasets huggingface_hub hf_transferyou should be good to go.
Please let us know if this works and mark this issue as close or complete once it is resolved. Thank you!
Merge pull request unslothai#221 from unslothai/feature/clear-unsloth…
CI(notebooks): cross-repo validator for unslothai/notebooks