'textclips in moviepy on google colab (imagemagick error)

I'm trying to add text to a moviepy video, but I'm having trouble getting imagemagick to work on google colab.

The code:

!apt install imagemagick
from moviepy.editor import TextClip
txtClip = TextClip('Cool effect',color='white',
 font="Amiri-Bold", kerning = 5, fontsize=100)

The error:

OSError: MoviePy Error: creation of None failed because 
of the following error:

[Errno 2] No such file or directory: 'unset': 'unset'.

.This error can be due to the fact that ImageMagick is 
not installed on your computer, or (for Windows users) 
that you didn't specify the path to the ImageMagick 
binary in file conf.py, or that the path you specified 
is incorrect

research:

Attempt at resolving the issue:

Based on the error message, I started looking for the conf.py file. I ran !find / -type d -name "conf.py" but none of the files returned seemed to be under the subdirectory of imagemagick.

I also modified the policy.xml file under /etc/ImageMagick-6 by commenting out the line <!--<policy domain="path" rights="none" pattern="@*"/>--> but to no avail seemingly.

Any ideas??



Solution 1:[1]

I had the same issue. Check if this work for you: Install with:

!apt install imagemagick

Then to fix the issue that it thinks ImageMagick is not installed use this:

!cat /etc/ImageMagick-6/policy.xml | sed 's/none/read,write/g'> /etc/ImageMagick-6/policy.xml

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Penaloza