All jobs

Fix "ModuleNotFoundError: No module named 'moviepy.editor'"

Yes. An agent finds the MoviePy 2 release that dropped moviepy.editor, ports your subclip, fade and concat calls to the new names, and renders a test clip.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

MoviePy 2.0.0 removed the moviepy.editor module. On 2.0.0, 2.1.1 and 2.1.2, from moviepy.editor import VideoFileClip raises ModuleNotFoundError: No module named 'moviepy.editor', while from moviepy import VideoFileClip, concatenate_videoclips, vfx imports. The classes moved, and so did their methods: on 2.1.2 a VideoFileClip has subclipped, with_duration, with_start, resized and with_effects, and no subclip, set_duration, set_start, resize, fadein or fadeout. Fades became effect objects, vfx.FadeIn, vfx.FadeOut, vfx.CrossFadeIn and vfx.CrossFadeOut, passed as a list to with_effects. concatenate_videoclips(clips, method=...) and write_videofile(filename, codec=..., audio_codec=...) kept their shape.

SamurAIGPT/Clip-Anything is a small script that cuts the parts of a video that match a prompt. app.py line 3 is the broken import, and edit_video at line 66 is where the old API lives: line 72 builds each clip with video.subclip(start, end).fadein(fade_duration).fadeout(fade_duration), line 75 joins them with concatenate_videoclips(clips, method="compose") and line 76 writes the result with write_videofile(output_video_path, codec="libx264", audio_codec="aac"). requirements.txt pins moviepy==1.0.3 beside numpy==2.0.2, torch==2.4.1 and openai-whisper==20231117, and that pin is why the repository still runs: in a fresh environment with those pins the editor import works. The README's Quick Start says to run python clip_anything.py, a file the repository does not have; the script is app.py. Anyone who follows a tutorial and runs pip install moviepy instead of the pinned file gets 2.x and the error on line 3.

The agent starts by reproducing both sides. In one virtual environment it installs the pinned requirements and imports app; in a second it installs the current MoviePy, imports, and keeps the traceback. It then lists every MoviePy name the file uses, which in this script is five: the two imports, subclip, fadein and fadeout. The port is from moviepy import VideoFileClip, concatenate_videoclips, vfx, video.subclipped(start, end).with_effects([vfx.FadeIn(fade_duration), vfx.FadeOut(fade_duration)]), and no change to the concatenation or the write. requirements.txt moves to a 2.x pin so the pinned and the unpinned install agree.

main() transcribes with Whisper, posts the transcript to Groq with a placeholder bearer token on line 44 and parses the answer with ast.literal_eval on line 63, none of which the agent needs. It tests edit_video on its own: it generates a few seconds of video with ffmpeg, installing ffmpeg in the sandbox if it is missing, passes two segments through edit_video, and checks that the output file exists and has the expected length with ffprobe. The transcription and the model call stay untouched, with a note in the pull request that the hard-coded token on line 44 should come from an environment variable.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "This repository fails with ModuleNotFoundError: No module named 'moviepy.editor'. In a clean virtual environment, install requirements.txt and report the installed moviepy version and whether the import works; then install the current moviepy release in a second environment and capture the traceback. List every moviepy name the code uses (imports, clip methods such as subclip, fadein, fadeout, set_duration, resize, and functions such as concatenate_videoclips) with file and line, and for each one say what MoviePy 2 calls it, checking against the installed package rather than from memory. Port the code to MoviePy 2: top-level imports, subclipped, with_effects with vfx.FadeIn and vfx.FadeOut, and keep concatenate_videoclips and write_videofile as they are if their arguments still exist. Update requirements.txt to a MoviePy 2 pin. Do not run Whisper and do not call any model API. Generate a short test video with ffmpeg (install ffmpeg if needed), run the edit function on two segments, and check the output with ffprobe. Add that as a test. Open a pull request listing each renamed call, the two tracebacks, and the test output.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A pull request that touches app.py, requirements.txt and a new test file. The description opens with the two tracebacks side by side: the import that passes on the pinned 1.0.3 and the one that fails on the current release, so the reader can see the error is a version boundary and not a broken install. Below it is a table of each MoviePy call the file made, the line it is on, and the 2.x name it now uses.

The session's record keeps every command: both installs, the ffmpeg command that produced the test clip, the test run and the ffprobe output of the file the ported edit_video wrote. A reviewer who wants to see the fades plays the output clip from the session's artifacts rather than taking the test's word for it.

Before merging, a reviewer checks that the fade duration still applies to each clip rather than once to the joined video, that method="compose" was kept, and that the new pin matches the MoviePy the rest of the team installs. If the project is also run from a notebook or a second script, those need the same port and the pull request says whether it found any.

Run it on every failed install or build

A fresh install is where this error appears first: a new laptop, a rebuilt container or a CI job that does not use the pinned file. When CI fails on an import error, a handler on your server reads the failure, and sends this request with POST /o/{org}/sessions with the repository in resources and the failing command's output appended to input. Give it a request_id that is a UUID v5 of the CI run id, so a retried delivery returns the run that already started instead of opening a second pull request.

An alerting tool that captures the exception in production can start the same run through an automation with a webhook trigger on the Project. Sentry signs its own requests and cannot add the bearer header the trigger's URL needs, so a small handler receives Sentry's webhook and forwards the payload to the trigger's URL with Authorization: Bearer <its secret>, which reaches the agent as data after the prompt.

The use case this job follows, with its automation and trigger: Fix a bug from an alert.

Why run it on Rush?

The port is small; the proof is not. Showing that a video edit still works means installing two MoviePy releases, ffmpeg and the project's torch dependency, generating a clip and rendering another, and that is a poor use of a laptop or a shared CI runner. In a Rush sandbox the agent does all of it on its own disk, keeps the rendered output as an artifact, and the machine is gone when the run ends.

What comes back is checkable. The session's transcript holds the failing import, the passing one, and the ffprobe of the rendered file, so a reviewer reads evidence instead of a description. A team with several video scripts forked from the same tutorial starts one run per repository with the same request, up to the key's max_concurrent limit at once, and the rest queue.

Frequently asked questions

Can I just pin moviepy==1.0.3 and move on?

If every install goes through requirements.txt, the pin already protects you; the example repository has it. The error comes from installs that do not use the pin, such as a tutorial's pip install moviepy. The port makes both paths work, and the pull request moves the pin to a 2.x release so the two agree.

What replaced fadein and fadeout?

Effects. In MoviePy 2 a clip gets with_effects([vfx.FadeIn(d), vfx.FadeOut(d)]), where vfx.FadeIn takes a duration and an optional initial_color. The agent reads the signature from the installed package before writing the call.

Does concatenate_videoclips still accept method="compose"?

Yes. On 2.1.2 its parameters are clips, method, transition, bg_color, is_mask and padding, so the line stays as it is. write_videofile also keeps codec and audio_codec.

Will the agent run Whisper or call Groq?

No. The request forbids both. The test exercises edit_video on a clip the agent generates with ffmpeg, which is the only function the error touches. The model call and its hard-coded token are left for you, with a note in the pull request.

Why does the README name a file that does not exist?

The Quick Start runs python clip_anything.py while the code is in app.py. The agent points that out in the pull request and corrects the line, since a reader hitting the import error usually started from that README.

More jobs like this: Fix a bug from an alert

Keep reading