DEV Community

Cover image for Installing Hugging Face on an M2 macOS Machine
Sophia Parafina
Sophia Parafina

Posted on

Installing Hugging Face on an M2 macOS Machine

If you are installing Hugging Face transformers on a M2 macOS machine, you might run into this error

× Getting requirements to build wheel 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]

If you're installing with pip, do the following before starting the install:

pip install --upgrade pip
pip install 'transformers[tf-cpu]'
brew install sentencepiece
pip install sentencpiece

This will resolve the error when installing sentencepiece.

Top comments (0)