Reputation: 21
I am packaging my app on Ubunutu using pyinstaller, and import ffpyplayer
in my code. pyinstaller builds the executable, but when I execute the program I receive this error:
Traceback (most recent call last): File "hdc.py", line 13, in File "PyInstaller/loader/pyimod03_importers.py", line 540, in exec_module File "ffpyplayer/player/init.py", line 10, in File "ffpyplayer/player/player.pyx", line 2, in init ffpyplayer.player.player ModuleNotFoundError: No module named 'ffpyplayer.threading' [42447] Failed to execute script hdc
I am using ffpyplayer
along with opencv
to playback a local video file. Using PyCharm as my IDE and both ffpyplayer
and opencv
work flawlessly in the IDE, as well as from the command prompt. I have tried pyinstaller with and without the --onefile
option, same result.
How can I resolve this issue? Thx.
Upvotes: 2
Views: 789
Reputation: 21
so based off this https://github.com/matham/ffpyplayer/issues/59#issuecomment-588044409
In your specfile do: import ffpyplayer
and then in your tree line add: ffpyplayer.dep_bins
to the list. If there's multiple sources your tree would end up looking like: *[Tree(p) for p in (source1 + source2 + ffpyplayer.dep_bins)]
edit: there is more you need to add AND to remove.
You also need to add to the datas=[] line in your specfile. There is an example here: https://github.com/matham/filers2/blob/master/packaging/Filers2.spec
So minimally do:
datas = ['ffpyplayer', 'ffpyplayer.pic','ffpyplayer.threading', 'ffpyplayer.tools', 'ffpyplayer.writer','ffpyplayer.player', 'ffpyplayer.player.clock', 'ffpyplayer.player.core', 'ffpyplayer.player.decoder', 'ffpyplayer.player.frame_queue', 'ffpyplayer.player.player', 'ffpyplayer.player.queue']
to get it to work you uninstall the gstreamer dependency as per: https://github.com/kivy/kivy/issues/6964#issuecomment-790869214
like so: Kivy Install gone awry - Windows 10 (was working, now not after gstreamer)
after you python -m pip uninstall kivy.deps.gstreamer
then compile again with pyinstall and ffpyplayer should work
Upvotes: 0