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

Unable to install sentencepiece on Python 3.12 #932

Closed
enricogandini opened this issue Nov 7, 2023 · 3 comments
Closed

Unable to install sentencepiece on Python 3.12 #932

enricogandini opened this issue Nov 7, 2023 · 3 comments

Comments

@enricogandini
Copy link

enricogandini commented Nov 7, 2023

When I run pip install sentencepiece, I get the following error:

Collecting sentencepiece
  Using cached sentencepiece-0.1.99.tar.gz (2.6 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: sentencepiece
  Building wheel for sentencepiece (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [62 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/sentencepiece
      copying src/sentencepiece/__init__.py -> build/lib.linux-x86_64-cpython-312/sentencepiece
      copying src/sentencepiece/_version.py -> build/lib.linux-x86_64-cpython-312/sentencepiece
      copying src/sentencepiece/sentencepiece_model_pb2.py -> build/lib.linux-x86_64-cpython-312/sentencepiece
      copying src/sentencepiece/sentencepiece_pb2.py -> build/lib.linux-x86_64-cpython-312/sentencepiece
      running build_ext
      /bin/sh: 1: pkg-config: Permission denied
      ./build_bundled.sh: 21: cmake: Permission denied
      ./build_bundled.sh: 22: cmake: Permission denied

...

subprocess.CalledProcessError: Command '['./build_bundled.sh', '0.1.99']' returned non-zero exit status 127.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for sentencepiece
  Running setup.py clean for sentencepiece
Failed to build sentencepiece
ERROR: Could not build wheels for sentencepiece, which is required to install pyproject.toml-based projects

So it seems like the installation process of sentencepiece calls a build_bundled.sh script, which internally uses cmake, for which permission is denied.

System information

Python: 3.12.0
OS: Ubuntu 22.04.3

Notes

I think this issue is specific to Python 3.12: pip install sentencepiece works for me in a Python 3.11 environment.
I think this may be related to the removal of distutils from Python 3.12 (see PEP 632).

@h-vetinari
Copy link
Contributor

Not sure if you are willing to consider conda, but we've had 3.12 builds of sentencepiece in conda-forge for almost two month now.

conda install -c conda-forge sentencepiece

@manueldeprada
Copy link

It worked for me after installing and removing cmake as a pip package. Here's a wheel, in case its useful:
sentencepiece-0.1.99-cp312-cp312-linux_x86_64.whl.zip

@taku910
Copy link
Collaborator

taku910 commented Feb 19, 2024

Fixed in v0.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants