Home > Back-end >  executable with pyinstaller does not work with moviepy?
executable with pyinstaller does not work with moviepy?

Time:08-16

I have a script that needs moviepy, I wanted to have it as an executable but that doesn't seem to work, does anyone know if there is a workaround for this?

from moviepy.editor import *

Console:

./run 
Traceback (most recent call last):
  File "run.py", line 21, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "moviepy/editor.py", line 87, in <module>
  File "<string>", line 1, in <module>
AttributeError: module 'moviepy.audio.fx.all' has no attribute 'audio_fadein'
[75721] Failed to execute script 'run' due to unhandled exception!

CodePudding user response:

  1. First create a virtual environment using venv.

  2. Then create a requirements file, if you haven't done already.

    pip freeze > requirements.txt

  3. Use this requirements file in your pyinstaller, while creating executable.

    path\to\pyinstaller.exe --onefile --paths \venv_location\file.py

  4. You can go through PyInstaller Docs for more details.

CodePudding user response:

Ok I got it to run, but it's not pretty

  • Related