Replies: 3 comments 5 replies
-
Ensure that the pip show sentence-transformers If the package is installed, you should see details about it. If not, install it using: pip install sentence-transformers Additionally, make sure there are no typos in the import statement and that the Python environment being used to run the code is the same one where the package is installed. The relevant part of the code that handles the import is: try:
from sentence_transformers import SentenceTransformer
except ImportError:
raise ImportError(
"Could not import sentence_transformer python package. "
"This is needed in order to for SentenceTransformersTokenTextSplitter. "
"Please install it with `pip install sentence-transformers`."
) If the package is installed and you are still encountering the error, it might be due to an issue with the Python environment or path settings. Ensure that your IDE or script is using the correct Python interpreter [1]. If the issue persists, try uninstalling and reinstalling the pip uninstall sentence-transformers -y
pip install sentence-transformers==2.4.0 This has resolved similar issues for other users [2]. |
Beta Was this translation helpful? Give feedback.
-
I have not use conda, so the python enviroment is only one. and I can find the sentence_transformers package in path(.pyenv/versions/3.9.18/lib/python3.9/site-packages). it's so strange! Can anyone help me? |
Beta Was this translation helpful? Give feedback.
-
Is someone looking into this?
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
i try to run the code, it show error
"""
File "/Users/za/.pyenv/versions/3.11.3/lib/python3.11/site-packages/langchain_community/embeddings/huggingface.py", line 74, in init
raise ImportError(
ImportError: Could not import sentence_transformers python package. Please install it with
pip install sentence-transformers
."""
sentence_transformers has been installed.
System Info
macos 14.4
python 3.9.18
langchain 0.0.345
transformers 4.42.2
torch 2.2.2
sentence_transformers 3.0.1 (i also have try v2.2.2)
Beta Was this translation helpful? Give feedback.
All reactions