Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

superboogav2 error when trying to run "cannot import name 'cached_download' from 'huggingface_hub'" #6660

Open
1 task done
imqqmi opened this issue Jan 12, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@imqqmi
Copy link

imqqmi commented Jan 12, 2025

Describe the bug

I get this error trying to run the superboogav2 extension on windows 10:

13:15:58-301120 ERROR Failed to load the extension "superboogav2".
Traceback (most recent call last):
File "D:\data\Projects\AIChat\LocalAI\installer_files\env\Lib\site-packages\chromadb\utils\embedding_functions.py", line 67, in init
from sentence_transformers import SentenceTransformer
File "D:\data\Projects\AIChat\LocalAI\installer_files\env\Lib\site-packages\sentence_transformers_init_.py", line 3, in
from .datasets import SentencesDataset, ParallelSentencesDataset
File "D:\data\Projects\AIChat\LocalAI\installer_files\env\Lib\site-packages\sentence_transformers\datasets_init_.py", line 3, in
from .ParallelSentencesDataset import ParallelSentencesDataset
File "D:\data\Projects\AIChat\LocalAI\installer_files\env\Lib\site-packages\sentence_transformers\datasets\ParallelSentencesDataset.py", line 4, in
from .. import SentenceTransformer
File "D:\data\Projects\AIChat\LocalAI\installer_files\env\Lib\site-packages\sentence_transformers\SentenceTransformer.py", line 12, in
from huggingface_hub import HfApi, HfFolder, Repository, hf_hub_url, cached_download
ImportError: cannot import name 'cached_download' from 'huggingface_hub' (D:\data\Projects\AIChat\LocalAI\installer_files\env\Lib\site-packages\huggingface_hub_init_.py)

Followed by:
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\data\Projects\AIChat\LocalAI\modules\extensions.py", line 37, in load_extensions
extension = importlib.import_module(f"extensions.{name}.script")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\data\Projects\AIChat\LocalAI\installer_files\env\Lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "D:\data\Projects\AIChat\LocalAI\extensions\superboogav2\script.py", line 19, in
from .api import APIManager
File "D:\data\Projects\AIChat\LocalAI\extensions\superboogav2\api.py", line 22, in
from .chromadb import ChromaCollector
File "D:\data\Projects\AIChat\LocalAI\extensions\superboogav2\chromadb.py", line 19, in
embedder = embedding_functions.SentenceTransformerEmbeddingFunction("sentence-transformers/all-mpnet-base-v2")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\data\Projects\AIChat\LocalAI\installer_files\env\Lib\site-packages\chromadb\utils\embedding_functions.py", line 69, in init
raise ValueError(
ValueError: The sentence_transformers python package is not installed. Please install it with pip install sentence_transformers

What I've tried:
Removing the imports to "cachce_download" and changing the path to a fixed location but that doesn't appear to help. I also tried to install an updated version of hugging_face_hub but that didn't work either (likely because I'm not really familiar with python). After that I tried some other general tips I found to resolve the error but I broke my installation.

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

Install test-generation-webui on Windows by starting the start_windows.bat file
Choosing A for CUDA recommended
Then closing the cli window
Run update and only update superboogav2 extention

Then run start_windows.bat again.

Screenshot

No response

Logs

No logs

System Info

CPU: 13900K
GPU: Inno3D iChill GeForce RTX 4070 Ti X3 OC
System RAM: 64GB
OS: Win10
@imqqmi imqqmi added the bug Something isn't working label Jan 12, 2025
@tnovak007
Copy link

Hi!

I had the same problem, and managed to fix it (I hope ) with "pip install -U sentence-transformers".

@imqqmi
Copy link
Author

imqqmi commented Jan 16, 2025

When I tried it, it would completely mess up my install and the app won't run. It's probably upgrading all kinds of dependencies that text-generation-webui relies on and breaks everything.
I'm not sure what you mean by 'I hope'. It either works or it doesn't.

@tnovak007
Copy link

I meant it looked like it was working, but I'm not sure if I'll find a new problem later. Because I did it today and only tested it briefly afterwards.

Note: I deleted installer_files before and did a clean install.

Then it loads fine without error:

16:24:08-011623 INFO     Loading the extension "openai"
16:24:08-013049 INFO     Loading the extension "gallery"
16:24:08-014047 INFO     Loading the extension "google_translate"
16:24:08-015047 INFO     Loading the extension "superboogav2"
16:24:11-087093 DEBUG    Loading hyperparameters...

Running on local URL:  http://127.0.0.1:7860

@imqqmi
Copy link
Author

imqqmi commented Jan 16, 2025

Ok thanks! Did you run the command in the cmd_windows.bat prompt? In the main text-generation-webui or in the extension folder? Not sure is that makes any difference. Many times it seems to install but I still get the same error. When I use the conda command to install the same package the while app gets messed up and won't start at all. Or I get errors stating that the caching package is missing or something like that. Then it goes deeper into the dependency rabbit hole.

@tnovak007
Copy link

tnovak007 commented Jan 16, 2025

Yes, I too tried the conda command but it broke the installation, that's why I needed to do clean install.

I did run the command through cmd_windows.bat (I still had the window open, here is the log:)

(D:\A\CHAT\text-generation-webui-main\installer_files\env) D:\A\CHAT\text-generation-webui-main>pip install -U sentence-transformers
Requirement already satisfied: sentence-transformers in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (2.2.1)
Collecting sentence-transformers
  Downloading sentence_transformers-3.3.1-py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: transformers<5.0.0,>=4.41.0 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from sentence-transformers) (4.48.0)
Requirement already satisfied: tqdm in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from sentence-transformers) (4.67.1)
Requirement already satisfied: torch>=1.11.0 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from sentence-transformers) (2.4.1+cu121)
Requirement already satisfied: scikit-learn in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from sentence-transformers) (1.6.1)
Requirement already satisfied: scipy in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from sentence-transformers) (1.15.1)
Requirement already satisfied: huggingface-hub>=0.20.0 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from sentence-transformers) (0.27.1)
Requirement already satisfied: Pillow in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from sentence-transformers) (10.4.0)
Requirement already satisfied: filelock in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from huggingface-hub>=0.20.0->sentence-transformers) (3.13.1)
Requirement already satisfied: fsspec>=2023.5.0 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from huggingface-hub>=0.20.0->sentence-transformers) (2024.2.0)
Requirement already satisfied: packaging>=20.9 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from huggingface-hub>=0.20.0->sentence-transformers) (24.2)
Requirement already satisfied: pyyaml>=5.1 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from huggingface-hub>=0.20.0->sentence-transformers) (6.0.2)
Requirement already satisfied: requests in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from huggingface-hub>=0.20.0->sentence-transformers) (2.32.3)
Requirement already satisfied: typing-extensions>=3.7.4.3 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from huggingface-hub>=0.20.0->sentence-transformers) (4.12.2)
Requirement already satisfied: sympy in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from torch>=1.11.0->sentence-transformers) (1.13.1)
Requirement already satisfied: networkx in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from torch>=1.11.0->sentence-transformers) (3.2.1)
Requirement already satisfied: jinja2 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from torch>=1.11.0->sentence-transformers) (3.1.5)
Requirement already satisfied: colorama in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from tqdm->sentence-transformers) (0.4.6)
Requirement already satisfied: numpy>=1.17 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from transformers<5.0.0,>=4.41.0->sentence-transformers) (1.26.4)
Requirement already satisfied: regex!=2019.12.17 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from transformers<5.0.0,>=4.41.0->sentence-transformers) (2024.11.6)
Requirement already satisfied: tokenizers<0.22,>=0.21 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from transformers<5.0.0,>=4.41.0->sentence-transformers) (0.21.0)
Requirement already satisfied: safetensors>=0.4.1 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from transformers<5.0.0,>=4.41.0->sentence-transformers) (0.5.2)
Requirement already satisfied: joblib>=1.2.0 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from scikit-learn->sentence-transformers) (1.4.2)
Requirement already satisfied: threadpoolctl>=3.1.0 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from scikit-learn->sentence-transformers) (3.5.0)
Requirement already satisfied: MarkupSafe>=2.0 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from jinja2->torch>=1.11.0->sentence-transformers) (2.1.5)
Requirement already satisfied: charset-normalizer<4,>=2 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from requests->huggingface-hub>=0.20.0->sentence-transformers) (3.4.1)
Requirement already satisfied: idna<4,>=2.5 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from requests->huggingface-hub>=0.20.0->sentence-transformers) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from requests->huggingface-hub>=0.20.0->sentence-transformers) (2.3.0)
Requirement already satisfied: certifi>=2017.4.17 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from requests->huggingface-hub>=0.20.0->sentence-transformers) (2024.12.14)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in d:\a\chat\text-generation-webui-main\installer_files\env\lib\site-packages (from sympy->torch>=1.11.0->sentence-transformers) (1.3.0)
Downloading sentence_transformers-3.3.1-py3-none-any.whl (268 kB)
Installing collected packages: sentence-transformers
  Attempting uninstall: sentence-transformers
    Found existing installation: sentence-transformers 2.2.1
    Uninstalling sentence-transformers-2.2.1:
      Successfully uninstalled sentence-transformers-2.2.1
Successfully installed sentence-transformers-3.3.1

EDIT:
Just a note, I had 2.2.1 version installed (instead of 2.2.2) because I tried to fix it before by a downgrade (pip install sentence-transformers==2.2.1) but it didn't work.

Didn't try (pip install sentence-transformers==3.3.1), I think it should work too....

And if yes, maybe this bug could be fixed easily by updating extension requirements.txt from:

beautifulsoup4==4.12.2
chromadb==0.4.24
lxml
optuna
pandas==2.0.3
posthog==2.4.2
sentence_transformers==2.2.2
spacy
pytextrank
num2words

to

beautifulsoup4==4.12.2
chromadb==0.4.24
lxml
optuna
pandas==2.0.3
posthog==2.4.2
sentence_transformers==3.3.1
spacy
pytextrank
num2words

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants