I built a python environment on an ec2 instance and tried to put a sentence piece, but I stumbled a little.
~$ pip install sentencepiece
Collecting sentencepiece
Using cached https://files.pythonhosted.org/packages/72/e0/57edbab017a204e9f39448c1717292437a45b5f7cf3a9dbf4a9c026b03c5/sentencepiece-0.1.94.tar.gz
Installing collected packages: sentencepiece
Running setup.py install for sentencepiece ... error
Complete output from command /home/ubuntu/.pyenv/versions/3.7.3/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p1e9kzi7/sentencepiece/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-cjap2xh6/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/sentencepiece
copying src/sentencepiece/__init__.py -> build/lib.linux-x86_64-3.7/sentencepiece
copying src/sentencepiece/sentencepiece_model_pb2.py -> build/lib.linux-x86_64-3.7/sentencepiece
copying src/sentencepiece/sentencepiece_pb2.py -> build/lib.linux-x86_64-3.7/sentencepiece
running build_ext
Package sentencepiece was not found in the pkg-config search path. #here!
Perhaps you should add the directory containing `sentencepiece.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sentencepiece' found
Cloning into 'sentencepiece'...
Note: checking out '8336bbd0c1cfba02a879afe625bf1ddaf7cd93c5'.
pkg-config
Can't be found.
If you look at github of sentencepiece, you will find the following description.
On Ubuntu, the build tools can be installed with apt-get: % sudo apt-get install cmake build-essential pkg-config libgoogle-perftools-dev
Execute the following command with
sudo apt-get install cmake build-essential pkg-config libgoogle-perftools-dev
pip install sentencepiece
I was able to install it successfully.
Recommended Posts