pythonelectronpyinstallereel

Python: no module named 'bottle-websocket' when running an executable made with PyInstaller, including Eel module


I was playing around with the eel module for Python - gives an opportunity to run HTML + CSS/JS with the python functionality.

Made a simple program, tried to make an executable out of it via PyInstaller. No errors whatsoever, but when running this executable it crashes on the first line - import eel, telling - there is no module called 'bottle-websocket'.

I checked pip: eel, bottle-websocket are installed. Can't figure out what's the problem. Attachments:

main.py:

import eel
from os import path

eel.init(path.dirname(__file__) + "/web")
eel.start('main.html', block=False)
while True:
   eel.sleep(10)

Error:
Picture with the error while I try to start the exe

EDIT: PyInstaller Log


Solution

  • I was also having this same issue, but I finally fixed it, it was actually very very easy, first of all make sure you are using auto-py-to-exe to package your app.

    After inserting necessary details (script file,, extra files etc), you would see an advanced options tab probably below, click on it to expand it, look for the hidden imports label and insert "bottle-websocket" in the input field representing the hidden imports, that's basically all you need to do

    I HOPE THIS HELPS