Python Discord bot can't find ffmpeg despite installation

I’m working on a Discord music bot using Python and keep getting an ffmpeg error. Even though I installed ffmpeg and added it to my PATH, the bot still can’t find it. I’m using macOS El Capitan with Python 3.5.2 and the discord.py library.

Here’s the relevant code:

user_channel = (msg.author).voice_channel
audio_client = await music_bot.join_voice_channel(user_channel)
audio_player = await audio_client.create_ytdl_player(song_url)
audio_player.start()

The error message says:

FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
discord.errors.ClientException: ffmpeg/avconv was not found in your PATH environment variable

I’ve double checked that ffmpeg is installed and should be accessible through PATH. Has anyone else run into this issue? What am I missing here?

Same issue here on macOS. Reinstall ffmpeg with brew - brew install ffmpeg. Check your discord.py version too, older ones are weird with path detection. Also restart your IDE/terminal after updating PATH. That one got me stuck for hours lol

Had this exact problem building my first Discord bot last year. The issue isn’t that ffmpeg isn’t installed - discord.py just can’t find it where your bot’s running. What worked for me was explicitly setting the ffmpeg path in create_ytdl_player. Pass the executable parameter like this: await audio_client.create_ytdl_player(song_url, executable='/usr/local/bin/ffmpeg'). Run which ffmpeg in your terminal first to get the exact path. Also check if you’re running your bot in a virtual environment that might not have system PATH access. Sometimes restarting your terminal after installing ffmpeg helps since PATH changes don’t always kick in right away.

I had the same problem with discord.py on macOS. It’s usually because Python subprocess calls don’t inherit your shell’s PATH environment. Check if your bot can actually see ffmpeg by adding import subprocess; print(subprocess.check_output(['which', 'ffmpeg'])) before your audio code. If that fails, it’s a process environment issue, not an installation problem. You can also set PATH explicitly in your Python script with os.environ['PATH'] += ':/usr/local/bin' before importing discord. This way subprocess calls will find ffmpeg no matter how you launch the script. Though the executable parameter approach is cleaner.