Last modified: Apr 07, 2025 By Alexander Williams

How to Install Whisper in Python Step by Step

Whisper is OpenAI's speech recognition model. It converts spoken words into text. This guide helps you install Whisper in Python easily.

Prerequisites

Before installing Whisper, ensure you have Python 3.7 or later. Check your Python version using python --version.

You also need pip, Python's package installer. Update pip to the latest version for smooth installation.

 
# Check Python version
python --version

# Update pip
python -m pip install --upgrade pip

Install Whisper

Use pip to install Whisper. Run the following command in your terminal or command prompt.

 
pip install openai-whisper

This installs Whisper and its dependencies. The process may take a few minutes.

Verify Installation

After installation, verify Whisper works. Open a Python shell and import Whisper.

 
import whisper
print("Whisper installed successfully!")


Whisper installed successfully!

If you see this message, Whisper is ready. If not, check for errors.

Install FFmpeg

Whisper needs FFmpeg to process audio files. Install FFmpeg based on your OS.

For Windows, download FFmpeg from its official site. Add it to your system PATH.

For macOS, use Homebrew:

 
brew install ffmpeg

For Linux, use apt or yum:

 
sudo apt install ffmpeg

Basic Usage

Now, let's use Whisper to transcribe an audio file. Save your audio file as audio.mp3.

 
import whisper

# Load the model
model = whisper.load_model("base")

# Transcribe audio
result = model.transcribe("audio.mp3")

# Print the result
print(result["text"])

This code loads the base model and transcribes the audio. The result is printed.

Troubleshooting

If you face ModuleNotFoundError, check our guide on How To Solve ModuleNotFoundError.

Ensure all dependencies are installed. Reinstall Whisper if needed.

Conclusion

Installing Whisper in Python is simple. Follow these steps to set it up. Now you can transcribe audio with ease.

Whisper is powerful for speech recognition. Experiment with different models for better accuracy.