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

Python package's ImportErrors #3

Closed
gmflau opened this issue Oct 4, 2023 · 1 comment
Closed

Python package's ImportErrors #3

gmflau opened this issue Oct 4, 2023 · 1 comment

Comments

@gmflau
Copy link
Contributor

gmflau commented Oct 4, 2023

I ran into some Python package's ImportError issues when running the chat-your-pdf example. Below is the log from the chat-your-pdf-chatbot container:

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.
You can now view your Streamlit app in your browser.

Network URL: http://172.22.0.3:8080
External URL: http://76.132.34.138:8080

2023-10-04 20:58:09.068 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/redisvl/vectorize/text/huggingface.py", line 11, in init
from sentence_transformers import SentenceTransformer
File "/usr/local/lib/python3.9/site-packages/sentence_transformers/init.py", line 3, in
from .datasets import SentencesDataset, ParallelSentencesDataset
File "/usr/local/lib/python3.9/site-packages/sentence_transformers/datasets/init.py", line 1, in
from .DenoisingAutoEncoderDataset import DenoisingAutoEncoderDataset
File "/usr/local/lib/python3.9/site-packages/sentence_transformers/datasets/DenoisingAutoEncoderDataset.py", line 1, in
from torch.utils.data import Dataset
File "/usr/local/lib/python3.9/site-packages/torch/init.py", line 229, in
from torch._C import * # noqa: F403
ImportError: /usr/local/lib/python3.9/site-packages/torch/lib/libtorch_cuda.so: invalid ELF header

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.dict)
File "/app/main.py", line 9, in
from redisvl.llmcache.semantic import SemanticCache
File "/usr/local/lib/python3.9/site-packages/redisvl/llmcache/semantic.py", line 13, in
class SemanticCache(BaseLLMCache):
File "/usr/local/lib/python3.9/site-packages/redisvl/llmcache/semantic.py", line 32, in SemanticCache
vectorizer: Optional[BaseVectorizer] = HFTextVectorizer(
File "/usr/local/lib/python3.9/site-packages/redisvl/vectorize/text/huggingface.py", line 13, in init
raise ImportError(
ImportError: HFTextVectorizer requires sentence-transformers library. Please install with pip install sentence-transformers
2023-10-04 20:58:12.938 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/redisvl/vectorize/text/huggingface.py", line 11, in init
from sentence_transformers import SentenceTransformer
File "/usr/local/lib/python3.9/site-packages/sentence_transformers/init.py", line 3, in
from .datasets import SentencesDataset, ParallelSentencesDataset
File "/usr/local/lib/python3.9/site-packages/sentence_transformers/datasets/init.py", line 1, in
from .DenoisingAutoEncoderDataset import DenoisingAutoEncoderDataset
File "/usr/local/lib/python3.9/site-packages/sentence_transformers/datasets/DenoisingAutoEncoderDataset.py", line 1, in
from torch.utils.data import Dataset
File "/usr/local/lib/python3.9/site-packages/torch/init.py", line 229, in
from torch._C import * # noqa: F403
ImportError: /usr/local/lib/python3.9/site-packages/torch/lib/libtorch_cuda.so: invalid ELF header

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.dict)
File "/app/main.py", line 9, in
from redisvl.llmcache.semantic import SemanticCache
File "/usr/local/lib/python3.9/site-packages/redisvl/llmcache/semantic.py", line 13, in
class SemanticCache(BaseLLMCache):
File "/usr/local/lib/python3.9/site-packages/redisvl/llmcache/semantic.py", line 32, in SemanticCache
vectorizer: Optional[BaseVectorizer] = HFTextVectorizer(
File "/usr/local/lib/python3.9/site-packages/redisvl/vectorize/text/huggingface.py", line 13, in init
raise ImportError(
ImportError: HFTextVectorizer requires sentence-transformers library. Please install with pip install sentence-transformers

@gmflau
Copy link
Contributor Author

gmflau commented Oct 5, 2023

I fixed it by cleaning the docker build cache in my environment using "$ docker builder prune" command. Then I ran "$ docker compose up" to build and launch the app.

@gmflau gmflau closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant