Repository navigation
Description
Hello,
I tried to install unsloth a while back, but got blocked by an installation issue regarding a module called 'packaging':
I've now had another try at installing from clean, and I still get the same error. I thought I'd list the actual commands I typed (along with some output) in the hope that you can tell me what the issue might be.
git clone https://github.com/unslothai/unsloth.git
cd unsloth
python -m venv venv
source venv/bin/activate
pip install --upgrade --force-reinstall --no-cache-dir torch==2.1.1 triton \
--index-url https://download.pytorch.org/whl/cu121
python
>>> import torch; torch.version.cuda
/home/zmx/m.2/Dev/llm/unsloth/venv/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.)
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),
'12.1'
pip install "unsloth[cu121_ampere_torch211] @ git+https://github.com/unslothai/unsloth.git"
but then I just get:
Collecting unsloth[cu121_ampere_torch211]@ git+https://github.com/unslothai/unsloth.git
Cloning https://github.com/unslothai/unsloth.git to /tmp/pip-install-y3fx393j/unsloth_8cc35d991fe645f298d4f6e4862c2475
Running command git clone --filter=blob:none --quiet https://github.com/unslothai/unsloth.git /tmp/pip-install-y3fx393j/unsloth_8cc35d991fe645f298d4f6e4862c2475
Resolved https://github.com/unslothai/unsloth.git to commit c1ac4d2707574868767345e76ebe49c8353f9057
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Collecting flash-attn
Using cached flash_attn-2.4.2.tar.gz (2.4 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-y3fx393j/flash-attn_a4b42c2db6314259aece0d624d5ebd3e/setup.py", line 9, in <module>
from packaging.version import parse, Version
ModuleNotFoundError: No module named 'packaging'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I tried to see if packaging was installed, which it didn't seem to be:
pip list
Package Version
----------------- -----------
filelock 3.9.0
fsspec 2023.4.0
Jinja2 3.1.2
MarkupSafe 2.1.3
mpmath 1.3.0
networkx 3.0
pip 22.0.2
setuptools 59.6.0
sympy 1.12
torch 2.1.1+cu121
triton 2.1.0
typing_extensions 4.4.0
and then I tried to install it:
pip install packaging
Collecting packaging
Using cached packaging-23.2-py3-none-any.whl (53 kB)
Installing collected packages: packaging
Successfully installed packaging-23.2
but I still get the same error message about packaging not being installed when I try to run the unsloth installer.
On the previous issue I filed, you (Daniel) said that you'd forgotten to add 'packaging' to pyproject.toml. I opened that file up, and it does seem that packaging is mentioned there:
[project.optional-dependencies]
huggingface = [
"transformers",
"datasets",
"sentencepiece",
"accelerate",
"trl",
"peft",
"packaging",
"ninja",
]
Like before, if I run the installer command that does not have _ampere in it, it all installs successfully. But I have a 4090 RTX, so I think I should be using the ampere version.
Activity
[-]I still can't get unsloth to install due to 'packaging'[/-][+]I still can't get unsloth _ampere version to install due to 'packaging'[/+]danielhanchen commentedon Jan 14, 2024
@araleza Oh if the non ampere path works - I found Xformers has the same performacne with Flash Attention v2, albeit teeny (ie 0.1% differences).
I would just use the non ampere path for now if that works - it seems like it's an error with Flash Attention itself
araleza commentedon Jan 14, 2024
Alright, will do. Thanks for the quick response!
danielhanchen commentedon Jan 15, 2024
Great!
hagoston commentedon Feb 13, 2024
I encountered the same issue and managed to resolve it by upgrading wheel. Running
pip install --upgrade wheeldid the trick for me.
Hope this helps others facing a similar problem!
danielhanchen commentedon Feb 14, 2024
@hagoston Oh great! Actually I might add this directly into our install dependencies!
Merge pull request unslothai#88 from unslothai/fix/change-labels-in-d…
Studio: MiniMax-H3-Image GGUFs on stable-diffusion.cpp, sd.cpp prebui…