moviepy: RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.

Expected Behavior

not getting an error

Actual Behavior

getting the error in the title

Steps to Reproduce the Problem

be me and try to run from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip

ffmpeg is installed with apt and i can confirm its location in /usr/bin/. additionally ive also executed pip install imageio-ffmpeg in the python virtual environment and it is installed. ive logged platform.python_version() to confirm i was in the 3.8.0 venv. executing a plain interpreter terminal in the venv and trying to import it manually does not resault in an error. only during execution. the execution is in a flask application deployed with gunicorn and nginx.

Specifications

  • Python Version: 3.8.0
  • Moviepy Version: the newest
  • Platform Name: Ubunto server
  • Platform Version: 18.04

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 26

Most upvoted comments

Ok, try this before importing moviepy:

import os
os.environ["IMAGEIO_FFMPEG_EXE"] = "/usr/bin/ffmpeg"

For those on MAC, if you install ffmpeg with Homebrew, then the path is different, so the code become :

import os

os.environ["IMAGEIO_FFMPEG_EXE"] = "/opt/homebrew/Cellar/ffmpeg/5.1/bin/ffmpeg"

Hi, I am also getting the same error while working in pydroid for Android (similar to linux environment) But I am not able to solve this issue even after the import os. My error-

Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
    start(fakepyfile,mainpyfile)
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
    exec(open(mainpyfile).read(),  __main__.__dict__)
  File "<string>", line 4, in <module>
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__
    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_reader.py", line 35, in __init__
    infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_reader.py", line 257, in ffmpeg_parse_infos
    proc = sp.Popen(cmd, **popen_params)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/subprocess.py", line 856, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/subprocess.py", line 1728, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/ffmpeg'

Any help will be appreciated ๐Ÿ˜ƒ

sudo apt install ffmpeg it will fix the issue

For Mac users, use this command:

brew install ffmpeg

it shows RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable. while using on android

please help!

step 1

python3 -m pip install moviepy

step 2

apt install ffmpeg

Hi, I am also getting the same error while working in pydroid for Android (similar to linux environment) But I am not able to solve this issue even after the import os. My error-

Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
    start(fakepyfile,mainpyfile)
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
    exec(open(mainpyfile).read(),  __main__.__dict__)
  File "<string>", line 4, in <module>
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__
    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_reader.py", line 35, in __init__
    infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_reader.py", line 257, in ffmpeg_parse_infos
    proc = sp.Popen(cmd, **popen_params)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/subprocess.py", line 856, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/subprocess.py", line 1728, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/ffmpeg'

Any help will be appreciated ๐Ÿ˜ƒ

For Mac users, use this command:

brew install ffmpeg

That made the trick for me. Thank you.

step 1

python3 -m pip install moviepy

step 2

apt install ffmpeg

Unfortunately, this doesnโ€™t work. Trying to run it on pydroid 3, Android version 12.