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

Installing previous sentencepiece versions #760

Closed
AJR07 opened this issue Jun 25, 2022 · 1 comment
Closed

Installing previous sentencepiece versions #760

AJR07 opened this issue Jun 25, 2022 · 1 comment

Comments

@AJR07
Copy link

AJR07 commented Jun 25, 2022

Hello everyone,
I have encountered a few issues installing sentencepiece, especially previous versions of it. I am trying to install the version 0.1.83. (https://pypi.org/project/sentencepiece/0.1.83/#files)

According to the README.md, I have tried installing it via:

  1. vcpkg: I created a vcpkg.json (with relevant overrieds and dependancies), installed it using ./vcpkg/vcpkg install. It installed successfully but for some reason importing sentencepiece using python doesn't work.
  2. Next, I tried pip install sentencepiece=0.1.83 but it threw this error:
Defaulting to user installation because normal site-packages is not writeable
Collecting sentencepiece==0.1.83
  Using cached sentencepiece-0.1.83.tar.gz (497 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-rdw7r3k_/sentencepiece_27491a53a3404712b5828f2c232e169a/setup.py", line 29, in <module>
          with codecs.open(os.path.join('..', 'VERSION'), 'r', 'utf-8') as f:
        File "/usr/local/anaconda/lib/python3.9/codecs.py", line 905, in open
          file = builtins.open(filename, mode, buffering)
      FileNotFoundError: [Errno 2] No such file or directory: '../VERSION'
      [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.

Upon looking at issue #386 it mentioned that the problem was fixed in 0.1.86, so I tried installing that using pip install 0.1.86 but this came out:

Defaulting to user installation because normal site-packages is not writeable
Collecting sentencepiece==0.1.86
  Using cached sentencepiece-0.1.86.tar.gz (495 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      Package sentencepiece was not found in the pkg-config search path.
      Perhaps you should add the directory containing `sentencepiece.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'sentencepiece' found
      Failed to find sentencepiece pkgconfig
      [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.

Then I found this issue #378 which suggested a few other things that I tried:
a. downloading the wheel named sentencepiece-0.1.83-cp37-cp37m-manylinux1_x86_64.whl, upgrading pip and setuptools and pip installing the wheel. This error occurred:

Defaulting to user installation because normal site-packages is not writeable
ERROR: sentencepiece-0.1.83-cp37-cp37m-manylinux1_x86_64.whl is not a supported wheel on this platform

It was an error raised in that issue but was not addressed.
b. Upon using python 3.7, the same errors occurred.
c. Making sure both cmake and pkg-config is installed. (same errors)

Does anyone know if I might have done something wrong (or not done something) and can aid me in installing sentencepiece version < 0.1.9? Thanks and have a nice day!

@taku910
Copy link
Collaborator

taku910 commented Jun 28, 2022

you might be able to build the whl package as follows.

% wget https://github.com/google/sentencepiece/archive/refs/tags/v0.1.83.tar.gz
% tar zxfv v0.1.83.tar.gz
% cd sentencepiece-0.1.83
% mkdir build
% cd build
% cmake .. -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=./root
% make -j20 install
% cd ../python
% env PKG_CONFIG_PATH=../build/root/lib/pkgconfig python3 setup.py bdist_wheel
% pip install dist/*.whl

@taku910 taku910 closed this as completed Jun 28, 2022
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