Steps to Install Diffusers on macOS

Tadashi Shigeoka ·  Sat, January 18, 2025

I’ll introduce the steps to install Diffusers on macOS.

Diffusers is a library developed by Hugging Face for generating images, audio, and even 3D molecular structures using diffusion models. This library supports a wide range of applications, from simple generation solutions to training custom diffusion models.

Operating Environment

  • macOS 15.3.1 (Apple Silicon M1 Max)
  • Python 3.12.9
    • Python 3.13 didn’t work, so I used 3.12

Diffusers Installation Steps

To build independent environments for each project, it’s strongly recommended to create a Python virtual environment. This prevents library version conflicts between different projects.

# If using asdf (optional)
asdf local python 3.12.9
 
# Create virtual environment (creates a directory named .env)
python -m venv .env
 
# Activate virtual environment
source .env/bin/activate
 
# (To exit virtual environment, run `deactivate` command)

2. Install Required Libraries

Several dependency libraries need to be installed to use Diffusers.

# Install PyTorch (install latest version for macOS)
pip install torch
 
# Transformers (dependency for Diffusers)
pip install transformers
 
# Accelerate (used for efficient training and inference)
pip install accelerate
 
# Other necessary libraries (needed to prevent errors)
pip install protobuf sentencepiece

3. Install Diffusers

pip install diffusers

That’s all from the Gemba.