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

Error installing sentence-transformers with pip in Windows 10 -> Error: Getting requirements to build wheel did not run successfully #2468

Closed
jstoppa opened this issue Feb 4, 2024 · 3 comments

Comments

@jstoppa
Copy link

jstoppa commented Feb 4, 2024

I'm trying to install sentence-transformers in Windows 10 and I can't get it to work.

Version:

  • Python: 3.12.0
  • Pip: 24.0
  • PyTorch: 2.2.0
  • Transformers: 4.37.2

I followed the guide in here https://github.com/UKPLab/sentence-transformers?tab=readme-ov-file#installation

pip install -U sentence-transformers

I get the following error:

Collecting sentence-transformers
  Using cached sentence_transformers-2.3.1-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: transformers<5.0.0,>=4.32.0 in c:\xlf_git\ai_env\lib\site-packages (from sentence-transformers) (4.37.2)
Requirement already satisfied: tqdm in c:\xlf_git\ai_env\lib\site-packages (from sentence-transformers) (4.66.1)
Requirement already satisfied: torch>=1.11.0 in c:\xlf_git\ai_env\lib\site-packages (from sentence-transformers) (2.2.0)
Requirement already satisfied: numpy in c:\xlf_git\ai_env\lib\site-packages (from sentence-transformers) (1.26.1)
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)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      Traceback (most recent call last):
        File "C:\XLF_GIT\ai_env\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\XLF_GIT\ai_env\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\XLF_GIT\ai_env\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel     
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\jstop\AppData\Local\Temp\pip-build-env-sikeuhr9\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\jstop\AppData\Local\Temp\pip-build-env-sikeuhr9\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\jstop\AppData\Local\Temp\pip-build-env-sikeuhr9\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup       
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\jstop\AppData\Local\Temp\pip-build-env-sikeuhr9\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup       
          exec(code, locals())
        File "<string>", line 126, in <module>
        File "C:\Users\jstop\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 408, in check_call
          retcode = call(*popenargs, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\jstop\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 389, in call
          with Popen(*popenargs, **kwargs) as p:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\jstop\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "C:\Users\jstop\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.

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

any idea what I could be doing wrong?

@tomaarsen
Copy link
Collaborator

Hello!

It seems that sentencepiece does not support Python 3.12, most likely. See also google/sentencepiece#968 and google/sentencepiece#932. You can use Python 3.11, or use conda, it seems.

  • Tom Aarsen

@jstoppa
Copy link
Author

jstoppa commented Feb 4, 2024

thanks, trying now with Python 3.11, I'll let everyone here know if it works. Now I remember I had the same issue with open interpreter

@jstoppa
Copy link
Author

jstoppa commented Feb 4, 2024

@tomaarsen you are absolutely right, it works with Python 3.11.
Closing the issue
Thanks

@jstoppa jstoppa closed this as completed Feb 4, 2024
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

2 participants