Get the following error while installing sentence-transformers on Windows 11 (using the latest version of Python and pip). Can someone please help with this? Checked many other similar posts, but none of those solutions work.
C:\Users\abc\ai\llama\jupyterproj\stlit>py -m pip install sentence-transformers
Collecting sentence-transformers
Using cached sentence_transformers-2.3.1-py3-none-any.whl.metadata (11 kB)
Collecting transformers<5.0.0,>=4.32.0 (from sentence-transformers)
Using cached transformers-4.37.2-py3-none-any.whl.metadata (129 kB)
Requirement already satisfied: tqdm in c:\users\abc\appdata\local\programs\python\python312\lib\site-packages (from sentence-transformers) (4.66.2)
Requirement already satisfied: torch>=1.11.0 in c:\users\abc\appdata\local\programs\python\python312\lib\site-packages (from sentence-transformers) (2.2.0)
Requirement already satisfied: numpy in c:\users\abc\appdata\local\programs\python\python312\lib\site-packages (from sentence-transformers) (1.26.4)
Collecting scikit-learn (from sentence-transformers)
Using cached scikit_learn-1.4.0-1-cp312-cp312-win_amd64.whl.metadata (11 kB)
Collecting scipy (from sentence-transformers)
Using cached scipy-1.12.0-cp312-cp312-win_amd64.whl.metadata (60 kB)
Collecting nltk (from sentence-transformers)
Using cached nltk-3.8.1-py3-none-any.whl (1.5 MB)
Collecting sentencepiece (from sentence-transformers)
Using cached sentencepiece-0.1.99.tar.gz (2.6 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\abc\AppData\Local\Temp\pip-install-3n9shirh\sentencepiece_fc383392079e43b6a8c226f0484c0928\setup.py", line 126, in <module>
subprocess.check_call([
File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 408, in check_call
retcode = call(*popenargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 389, in call
with Popen(*popenargs, **kwargs) as p:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
[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.
You need to use python 3.11
to install sentence-transformers
It is dependent on pytorch
https://pytorch.org/get-started/locally/#windows-python
Currently, PyTorch on Windows only supports Python 3.8-3.11; Python 2.x is not supported.
https://pypi.org/project/sentence-transformers/
We recommend Python 3.8 or higher, PyTorch 1.11.0 or higher and transformers v4.32.0 or higher. The code does not work with Python 2.7