17

I'm trying to work with VideoFileClip and vfx functions from the Moviepy library but my interpreter keeps throwing a 'ModuleNotFoundError: No module named 'moviepy.editor''.

I've installed and reinstalled Moviepy several times but to no avail

I tried: from moviepy.editor import VideoFileClip, vfx

I expected the import statement to work.

Edit:

  1. Other imports like 'from moviepy.video.io.VideoFileClip import VideoFileClip' seem to work except the moviepy.editor

  2. library imageio and the program ffmpeg have already been successfully downloaded so the replies from this post aren't helping

6
  • This question is similar to: Can't import moviepy.editor. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Dec 16, 2024 at 10:03
  • stackoverflow.com/search?q=moviepy.editor+no+module+named Commented Dec 16, 2024 at 10:04
  • Does this help from moviepy.editor import VideoFileClip? Commented Dec 16, 2024 at 10:56
  • @Christoph Rackwitz I've edited my question! Commented Dec 17, 2024 at 11:15
  • How did you install Moviepy; what command(s) did you use? And is there any chance you have multiple Python installations (e.g., an old one and a new one)? Can you import moviepy by itself? If so, what does print(moviepy) show you? What version of moviepy do you have installed? What version of Python? What OS are you using? Commented Dec 17, 2024 at 12:38

4 Answers 4

39

try:

from moviepy import VideoFileClip

instead of:

from moviepy.editor import VideoFileClip

It works.

Sign up to request clarification or add additional context in comments.

3 Comments

this works for me with moviepy 2.2.1
original error ModuleNotFoundError: No module named 'moviepy.editor' suggested change result: AttributeError: 'VideoFileClip' object has no attribute 'set_audio'. Did you mean: 'with_audio'? fixed with that code edit.
Name: moviepy Version: 2.2.1 for this version the solution proposed is correct
8

Newest verison of moviepy doesn't really contain editor.py file whether if you download it with pip, clone it from git etc.
You can always go back to a previous version of the library, not the ideal but definetly worked for me.


pip uninstall moviepy
pip install moviepy==1.0.3

2 Comments

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
so guys after the November release (2x) of moviepy they removed editor module to fix this error temporarily you can downgrade to Moviepy 1.0.3
2

Obviously, check your other requirements, but it appears that some versions of moviepy (at least at the time I am posting this) don't contain editor.py

Not ideal however, this script worked for me:

pip install moviepy==1.0.3 numpy>=1.18.1 imageio>=2.5.0 decorator>=4.3.0 tqdm>=4.0.0 Pillow>=7.0.0 scipy>=1.3.0 pydub>=0.23.0 audiofile>=0.0.0 opencv-python>=4.5

Comments

2

Moviepy change the structure. For version 2.2.1 that I using following code works. Try importing it as below:

from moviepy.video.VideoClip import TextClip, ImageClip  
from moviepy.video.compositing import CompositeVideoClip
from moviepy.video.io.VideoFileClip import VideoFileClip

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.