ModuleNotFoundError: No module named 'unsloth'
Closed this issue · 5 comments
After successfully running the following
`%%capture
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
from torch import version; from packaging.version import Version as V
xformers = "xformers==0.0.27" if V(version) < V("2.4.0") else "xformers"
!pip install --no-deps {xformers} trl peft accelerate bitsandbytes triton`
I tried to import FastLanguaugeModel from unsloth
from unsloth import FastLanguageModel
But I am getting the following error.
ModuleNotFoundError: No module named 'unsloth'
Can I please get a suggestion?
@vidithirve Try removing %%capture - you might see an error message
@danielhanchen Thanks for responding.
After removing %%capture, I got this
Defaulting to user installation because normal site-packages is not writeable Collecting unsloth[colab-new]@ git+https://github.com/unslothai/unsloth.git Cloning https://github.com/unslothai/unsloth.git to /tmp/pip-install-le4e3sy4/unsloth_f5290c82c45e405d9ab342196dc99907 Running command git clone --filter=blob:none --quiet https://github.com/unslothai/unsloth.git /tmp/pip-install-le4e3sy4/unsloth_f5290c82c45e405d9ab342196dc99907 Resolved https://github.com/unslothai/unsloth.git to commit 6c534341bb229b136f9504443f0161645d2070c5 Installing build dependencies ... Getting requirements to build wheel ... Installing backend dependencies ... Preparing metadata (pyproject.toml) ... WARNING: Generating metadata for package unsloth produced metadata for project name unknown. Fix your #egg=unsloth fragments. Discarding git+https://github.com/unslothai/unsloth.git: Requested unknown from git+https://github.com/unslothai/unsloth.git has inconsistent name: filename has 'unsloth', but metadata has 'unknown' ERROR: Could not find a version that satisfies the requirement unsloth (unavailable) (from versions: 2024.8) ERROR: No matching distribution found for unsloth (unavailable) Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: xformers in /home/crholmes/.local/lib/python3.10/site-packages (0.0.28.post1) Requirement already satisfied: trl in /home/crholmes/.local/lib/python3.10/site-packages (0.10.1) Requirement already satisfied: peft in /home/crholmes/.local/lib/python3.10/site-packages (0.12.0) Requirement already satisfied: accelerate in /home/crholmes/.local/lib/python3.10/site-packages (0.34.2) Requirement already satisfied: bitsandbytes in /home/crholmes/.local/lib/python3.10/site-packages (0.43.3) Requirement already satisfied: triton in /home/crholmes/.local/lib/python3.10/site-packages (3.0.0)
but after this, I tried running the next cell and it gave me the same error
ModuleNotFoundError: No module named 'unsloth'
Try pip install --upgrade pip
then also pip uninstall unsloth -y
and finally pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
Thank you @danielhanchen it worked out after doing as you mentioned.
Great!