Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFound: No module named 'imageio_ffmpeg', or imageio v2.5.0 is breaking ffmpeg detection in config #906

Closed
blueset opened this issue Feb 6, 2019 · 18 comments
Labels
lib-misc Issues pertaining to misc. 3rd-party libraries.

Comments

@blueset
Copy link

blueset commented Feb 6, 2019

Expected Behavior

No exception thrown while running

import moviepy.video.VideoClip

Actual Behavior

Exception thrown:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./venv/lib/python3.7/site-packages/moviepy/video/Video/vClip.py", line 18, in <module>
    from ..config import get_setting
  File "./venv/lib/python3.7/site-packages/moviepy/config.py", line 35, in <module>
    FFMPEG_BINARY = get_exe()
  File "./venv/lib/python3.7/site-packages/imageio/plugins/ffmpeg.py", line 49, in get_exe
    import imageio_ffmpeg
ModuleNotFoundError: No module named 'imageio_ffmpeg'

Steps to Reproduce the Problem

import moviepy.video.VideoClip

Specifications

  • Python Version: 3.7
  • Moviepy Version: 0.2.3.5
  • Platform Name: macOS
  • Platform Version: High Sierra

Cause

Recently imageio just updated to 2.5.0, deprecated imageio.plugins.ffmpeg.get_exe() and changed its behavior.

Now the new get_exe() requires the new package imageio_ffmpeg, but is neither required by moviepy nor imageio (as they are not using that function anymore).

This behavior has caused moviepy to stop working when trying to initialize the config.

Temporary circumvention

  1. Set environment variable FFMPEG_BINARY to the absolute path of ffmpeg, or
  2. Downgrade imageio to ~2.5.1
@Zulko
Copy link
Owner

Zulko commented Feb 6, 2019

Thanks for this, and sorry I didnt react to the changes in imageio earlier.

Would adding imageio_ffmpeg as a dependency solve the issue?

@blueset
Copy link
Author

blueset commented Feb 6, 2019

No worries, imageio just updated a few hours ago, and I got this exception from someone using my library which is depended on moviepy.

That does help to prevent the exception, but including imageio_ffmpeg will download the binary for most common platforms. It might be redundant if ffmpeg is already installed otherwise.

@Zulko
Copy link
Owner

Zulko commented Feb 6, 2019

I understand that this is not ideal but this seems like a reasonable solution for now. It seems that imageio used to download FFMPEG only if needed but that is not the case anymore.

It seems that imageio-ffmpeg is a nice and focused wrapper and moviepy could use much more of its api, but I don't have much time these days.

@namheegordonkim
Copy link

Would adding imageio_ffmpeg as a dependency solve the issue?

imageio_ffmpeg is only for Python 3.4+ and doesn't work for 2.7

@floAr
Copy link

floAr commented Feb 13, 2019

It appears that none of the workaround actually functions for me. I tried the moviepy + imagio 2.4.1 combi as well as the same + imagio_ffmpeg, as well as moviepy + imageio 2.5.0 + imageio_ffmpeg. Running on Windows within conda environment (Everything was installes from conda-forge).
Any tipps on how to proceed?

@Zulko
Copy link
Owner

Zulko commented Feb 13, 2019

I believe I fixed it on Github at least for Python 3 (not sure). Can you try to pip install from this Github repo and let me know if it works?

pip install --upgrade git+git://github.com/Zulko/moviepy

If it does I will push a new version on PyPI asap.

@floAr
Copy link

floAr commented Feb 13, 2019

I believe I fixed it on Github at least for Python 3 (not sure). Can you try to pip install from this Github repo and let me know if it works?

pip install --upgrade git+git://github.com/Zulko/moviepy

If it does I will push a new version on PyPI asap.

Yes this does the fix. I appreciate the quick response, saved me quite some time tonight

@Zulko
Copy link
Owner

Zulko commented Feb 13, 2019

Awesome. Could you confirm that you can run a minimal example? (this would reassure me that ffmpeg got downloaded properly and is usable by moviepy)

I can't push to Pypi from my current location, but I will, first chance I get.

@floAr
Copy link

floAr commented Feb 13, 2019

(moviepytest) C:\Users\velab>pip freeze
certifi==2018.8.24
pyspark==2.3.1
wincertstore==0.2

(moviepytest) C:\Users\velab>pip install --upgrade git+git://github.com/Zulko/moviepy
Collecting git+git://github.com/Zulko/moviepy
Cloning git://github.com/Zulko/moviepy to c:\users\velab\appdata\local\temp\2\pip-req-build-ny1pjptf
Collecting decorator<5.0,>=4.0.2 (from moviepy==0.2.4.0)
Downloading https://files.pythonhosted.org/packages/f1/cd/7c8240007e9716b14679bc217a1baefa4432aa30394f7e2ec40a52b1a708/decorator-4.3.2-py2.py3-none-any.whl
Collecting tqdm<5.0,>=4.11.2 (from moviepy==0.2.4.0)
Downloading https://files.pythonhosted.org/packages/6c/4b/c38b5144cf167c4f52288517436ccafefe9dc01b8d1c190e18a6b154cd4a/tqdm-4.31.1-py2.py3-none-any.whl (48kB)
100% |################################| 51kB 1.8MB/s
Collecting numpy (from moviepy==0.2.4.0)
Downloading https://files.pythonhosted.org/packages/2d/96/dc231b4bcd8781c16102e3deb5c857a39115917fe5abb8b137a36e453637/numpy-1.16.1-cp35-cp35m-win_amd64.whl (11.9MB)
100% |################################| 11.9MB 2.9MB/s
Collecting requests<3.0,>=2.8.1 (from moviepy==0.2.4.0)
Downloading https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl (57kB)
100% |################################| 61kB 6.8MB/s
Collecting proglog<=1.0.0 (from moviepy==0.2.4.0)
Using cached https://files.pythonhosted.org/packages/fe/ab/4cb19b578e1364c0b2d6efd6521a8b4b4e5c4ae6528041d31a2a951dd991/proglog-0.1.9.tar.gz
Collecting imageio<3.0,>=2.5 (from moviepy==0.2.4.0)
Using cached https://files.pythonhosted.org/packages/af/0a/943c965d372dae0b1f1482677d29030ab834351a61a9a632fd62f27f1523/imageio-2.5.0-py3-none-any.whl
Collecting imageio_ffmpeg>=0.2.0 (from moviepy==0.2.4.0)
Using cached https://files.pythonhosted.org/packages/8e/a0/56d5a02a9a77c1e8096218cf36aea8974a90deec7e3c6fdaf7d7d8c71333/imageio_ffmpeg-0.2.0-py3-none-win_amd64.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests<3.0,>=2.8.1->moviepy==0.2.4.0)
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
100% |################################| 143kB 10.2MB/s
Collecting idna<2.9,>=2.5 (from requests<3.0,>=2.8.1->moviepy==0.2.4.0)
Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
100% |################################| 61kB 5.1MB/s
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in c:\anaconda\envs\moviepytest\lib\site-packages (from requests<3.0,>=2.8.1->moviepy==0.2.4.0) (2018.8.24)
Collecting urllib3<1.25,>=1.21.1 (from requests<3.0,>=2.8.1->moviepy==0.2.4.0)
Downloading https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
100% |################################| 122kB 2.5MB/s
Collecting pillow (from imageio<3.0,>=2.5->moviepy==0.2.4.0)
Downloading https://files.pythonhosted.org/packages/b9/ba/43f2f2dd60f304d8563af82ecd4822ff0b57ddfd71631c407fce69da84d1/Pillow-5.4.1-cp35-cp35m-win_amd64.whl (1.9MB)
100% |################################| 1.9MB 6.4MB/s
Building wheels for collected packages: moviepy, proglog
Running setup.py bdist_wheel for moviepy ... done
Stored in directory: C:\Users\velab\AppData\Local\Temp\2\pip-ephem-wheel-cache-tn19dtan\wheels\25\11\dc\85ab0f47c656a71ecf524890d78f25692e8e4ac0e9c25c5899
Running setup.py bdist_wheel for proglog ... done
Stored in directory: C:\Users\velab\AppData\Local\pip\Cache\wheels\65\56\60\1d0306a8d90b188af393c1812ddb502a8821b70917f82dcc00
Successfully built moviepy proglog
Installing collected packages: decorator, tqdm, numpy, chardet, idna, urllib3, requests, proglog, pillow, imageio, imageio-ffmpeg, moviepy
Successfully installed chardet-3.0.4 decorator-4.3.2 idna-2.8 imageio-2.5.0 imageio-ffmpeg-0.2.0 moviepy-0.2.4.0 numpy-1.16.1 pillow-5.4.1 proglog-0.1.9 requests-2.21.0 tqdm-4.31.1 urllib3-1.24.1

(moviepytest) C:\Users\velab>python
Python 3.5.5 | packaged by conda-forge | (default, Jul 24 2018, 01:52:17) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from moviepy.editor import *

video = VideoFileClip("xxxxxxxx\random_grid_404.mp4").subclip(1,2)

result = CompositeVideoClip([video])
result.write_videofile("myHolidays_edited.webm",fps=25)
Moviepy - Building video myHolidays_edited.webm.
Moviepy - Writing video myHolidays_edited.webm

Moviepy - Done !
Moviepy - video ready myHolidays_edited.webm

Hope this helps. Created a fresh conda env (see pip freeze at top), installed from git and the run the sample form the website. Hope this is what you had in mind, if not let me know what specific sample / process you want me to run :)

@Zulko
Copy link
Owner

Zulko commented Feb 13, 2019

Looks good thanks!

@das7pad
Copy link
Contributor

das7pad commented Feb 13, 2019

ffmpeg is packaged in the wheels of imageio-ffmpeg only. And strangely this combination failed and downloaded the tar ball:
pip==18.1, wheel==0.33.0 (latest), moviepy via git

$ docker run --rm --tty python:3.7 bash -c "pip install 'pip<19' wheel==0.33.0 && pip install git+git://github.com/Zulko/moviepy" | grep imageio-ffmpeg-0.2.0.tar.gz
#   Downloading https://files.pythonhosted.org/packages/21/06/71fda709fea4ed4852fbb12c13c33c86040717302b71ad369474d1fdfe2e/imageio-ffmpeg-0.2.0.tar.gz

@das7pad
Copy link
Contributor

das7pad commented Feb 13, 2019

Let's lock imageio to a known good state until they fixed their ffmpeg integration.

@Zulko
Copy link
Owner

Zulko commented Feb 13, 2019

@das7pad From what I understand imageio is going to deprecate their old versions, meaning that they may point to deprecated URLs to download ffmpeg (ffmpeg didnt come with a wheel before, it was downloaded with imageio.ffmpeg.download() at runtime at the first use of Moviepy).

@das7pad
Copy link
Contributor

das7pad commented Feb 13, 2019

The binaries are still there - they were yanked but then put up again.

@Zulko
Copy link
Owner

Zulko commented Feb 13, 2019

Not sure what to do, let's ask @almarklein: what would you advise regarding @das7pad's last 3 comments (case where imageio-ffmpeg doesnt get installed as a wheel by pip, so ffmpeg doesn't come packaged with it)

@das7pad
Copy link
Contributor

das7pad commented Feb 13, 2019

Note: I opened an issue over in their repo: imageio/imageio-ffmpeg#12

@almarklein
Copy link

Sorry to put y'all through this. I posted in a new issue #908 that should answer most questions.

@keikoro keikoro added the lib-misc Issues pertaining to misc. 3rd-party libraries. label May 4, 2019
@tburrows13
Copy link
Collaborator

Looks like this was all sorted.

neggles added a commit to neggles/seed_travel that referenced this issue Mar 15, 2023
Fixes yownas#41 by adding imageio-ffmpeg to extension requirements/dependencies.

This is required due to some changes with moviepy's underlying imageio
library, which has deprecated/removed the old autoinstallation method
around 2019-ish, and as such moviepy is no longer capable of
autoinstalling ffmpeg.

See Zulko/moviepy#906 and Zulko/moviepy#908
for further details on the moviepy side.

This does result in downloading ffmpeg on systems where it may already
be installed, but it's a reasonably small download and on some systems
(eg Ubuntu 22.04) moviepy 1.0.3 fails to pick up system ffmpeg anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib-misc Issues pertaining to misc. 3rd-party libraries.
Projects
None yet
Development

No branches or pull requests

8 participants