DEV Community

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

Posted on

6

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay