print("--- MoviePy Installation Check ---") try: # 1. Try to import the main library import moviepy print(f"[SUCCESS] MoviePy core library imported successfully.") try: # Print version if possible print(f" Version detected: {moviepy.__version__}") except AttributeError: print(" Could not determine MoviePy version (older version?).") # 2. Try to import a core component (often fails if dependencies are missing) try: from moviepy.editor import VideoFileClip, TextClip print(f"[SUCCESS] MoviePy editor components (VideoFileClip, TextClip) imported.") # 3. Perform a very simple functional test (create a TextClip object) # This doesn't require external files or ImageMagick *just* to create the object. # Rendering it *would* often require ImageMagick. try: print("\n--- Running simple functional test (creating TextClip) ---") test_clip = TextClip("Test OK", fontsize=30, color='white') # Check if an object was created and has basic attributes if hasattr(test_clip, 'duration') and hasattr(test_clip, 'size'): print(f"[SUCCESS] Basic TextClip object created successfully.") print("\nMoviePy appears to be installed and minimally functional.") else: print("[WARNING] TextClip object created but seems incomplete. Check dependencies.") except Exception as test_e: print(f"[ERROR] Failed during simple functional test: {test_e}") print(" MoviePy might be installed, but a core function failed.") print(" This could indicate missing dependencies (like ImageMagick for TextClip rendering, though not strictly needed for object creation).") except ImportError as comp_e: print(f"[ERROR] Failed to import moviepy.editor components: {comp_e}") print(" MoviePy might be partially installed or core dependencies are missing.") except ImportError: print("[ERROR] Failed to import the 'moviepy' library.") print(" MoviePy is likely NOT installed in this Python environment.") print("\n To install it, try running:") print(" pip install moviepy") except Exception as e: print(f"[ERROR] An unexpected error occurred: {e}") print(" There might be a problem with your Python environment or the MoviePy installation.") print("\n--- Check complete ---")