10

I just got myself a new laptop, wanted to setup MoviePY on that new Windows 64x (Python3.7.0) machine. I triple checked everything but when it comes to text part of my code, it throws that error at me;

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

OSError: [WinError 6] The handle is invalid

"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"

My config_defaults.py file;

import os
FFMPEG_BINARY = os.getenv('FFMPEG_BINARY', 'ffmpeg-imageio')
#IMAGEMAGICK_BINARY = os.getenv('IMAGEMAGICK_BINARY', 'auto-detect')
IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick-7.0.8-Q16\\magick.exe"

The path is correct and both magick.exe and convert.exe exist in that path. I'm also sure ImageMagick is properly installed. When I type convert in cmd, it prints "ImageMagick 7.0.8 Q16 x64" and bunch of other stuff.

What am I missing here?

cem akbulut
  • 185
  • 1
  • 3
  • 12

4 Answers4

23

I had the same error as you but my problem was that I did not properly installed ImageMagick : in the installation wizard you need to check "install legacy utilities".

So I reinstalled it, checked this box and it worked.

Here is a screenshot of the page I am talking about : enter image description here

Medsiv
  • 270
  • 3
  • 12
6

Take the comment from the top line, and instead of auto-detect put the path and put the name convert.

IMAGEMAGICK_BINARY = os.getenv ('IMAGEMAGICK_BINARY', 'C:\Program Files\ImageMagick-7.0.8-Q16\convert.exe')
Jan Černý
  • 1,268
  • 2
  • 17
  • 31
  • 3
    for windows users, you might not find the `convert.exe`file. instead just use `magick.exe`. `IMAGEMAGICK_BINARY = os.getenv('IMAGEMAGICK_BINARY', 'C:\\Program Files\\ImageMagick-7.0.8-Q16\\magick.exe')` – Ziyad Moraished Mar 15 '19 at 07:52
  • 1
    This works. If you are using jupyter notebook, restart your kernel. – Leena Dec 28 '20 at 19:52
3

For windows users,

Change line 54 in config_defaults.py wherever moviepy library is installed

It can be in C:/users/anaconda/lib/site-packages if you are using anaconda

IMAGEMAGICK_BINARY = os.getenv('IMAGEMAGICK_BINARY', 'C:\Program Files\ImageMagick-7.0.11-Q16-HDRI\magick.exe')

will work

Onkar Chougule
  • 161
  • 1
  • 3
2

I had the same problem and it got fixed thanks to this comment.


from moviepy.config import change_settings
change_settings({"IMAGEMAGICK_BINARY": r"C:\\Program Files\\ImageMagick-7.0.8-Q16\\magick.exe"})

This solved the problem for me.

ivey221
  • 95
  • 7