Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

ModuleNotFoundError: No module named 'gevent.__hub_local' #62

Closed

Description

@Marcelpv96

Hi! when building a distributable binary, and try to execute it the following error appear:

Traceback (most recent call last):
  File "hello.py", line 1, in <module>
  File "/home/pc-ia/.local/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "eel/__init__.py", line 2, in <module>
  File "/home/pc-ia/.local/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "gevent/__init__.py", line 87, in <module>
  File "/home/pc-ia/.local/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "gevent/_hub_local.py", line 101, in <module>
  File "gevent/_util.py", line 105, in import_c_accel
  File "importlib/__init__.py", line 126, in import_module
ModuleNotFoundError: No module named 'gevent.__hub_local'

Activity

  1. changed the title [-]label:bug ModuleNotFoundError: No module named 'gevent.__hub_local'[/-] [+]ModuleNotFoundError: No module named 'gevent.__hub_local'[/+] on Jul 9, 2018
  2. sedir commented on Jul 13, 2018

    @sedir

    @Marcelpv96 why did you close the issue? I'm having the same problem and don't know why. Did you figure this out?

  3. Marcelpv96 commented on Jul 19, 2018

    @Marcelpv96
    Author

    @sedir I do not know why it appeared ... but I fixed it by installing these packages with this version:
    gevent==1.2.2
    Eel==0.9.7
    gevent-websocket==0.10.1
    greenlet==0.4.13
    PyInstaller==3.3.1

  4. ChrisKnott commented on Jul 19, 2018

    @ChrisKnott
    Collaborator

    @Marcelpv96 thanks, I'll add these as requirements

  5. abhishekwebcode commented on Jul 31, 2018

    @abhishekwebcode

    @Marcelpv96

    @sedir I do not know why it appeared ... but I fixed it by installing these packages with this version:
    gevent==1.2.2
    Eel==0.9.7
    gevent-websocket==0.10.1
    greenlet==0.4.13
    PyInstaller==3.3.1

    Great , it saved my day thanks
    I would like to know how this works

  6. aaknitt commented on Jan 12, 2019

    @aaknitt
    Contributor

    @sedir I do not know why it appeared ... but I fixed it by installing these packages with this version:
    gevent==1.2.2
    Eel==0.9.7
    gevent-websocket==0.10.1
    greenlet==0.4.13
    PyInstaller==3.3.1

    This also worked to me, but to clarify further for anyone else with this problem, it seems like the gevent version is the most important, and having a later version can cause problems. I was able to build but not run an EXE created with gevent==1.3.7 and after downgrading to 1.2.2 (pip install gevent==1.2.2) I was able to successfully build an EXE that ran under Windows.

  7. 3dformortals commented on Feb 10, 2019

    @3dformortals

    linux have similar fails, without way to solve it
    os kubuntu 18.04
    PyInstaller: 3.3.1
    Python: 3.6.7

    when i run pyinstaller with last bottle/bottle-websocket/gevent etc versions i have this fail of executable

    Traceback (most recent call last): File "d.py", line 3, in <module> File "/home/user/.local/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.__dict__) File "eel/__init__.py", line 2, in <module> File "/home/user/.local/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.__dict__) File "gevent/__init__.py", line 87, in <module> File "/home/user/.local/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.__dict__) File "gevent/_hub_local.py", line 101, in <module> File "gevent/_util.py", line 105, in import_c_accel File "importlib/__init__.py", line 126, in import_module ModuleNotFoundError: No module named 'gevent.__hub_local' [20371] Failed to execute script d

    When i rollback from fresh libs to gevent 1.2.2 (pip3 uninstall gevent -> pip3 install gevent=1.2.2) and rerun same i have this fail with executable

    Traceback (most recent call last): File "d.py", line 3, in <module> File "/home/user/.local/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.__dict__) File "eel/__init__.py", line 8, in <module> File "bottle.py", line 1797, in load_module ModuleNotFoundError: No module named 'bottle_websocket' [20916] Failed to execute script d

    @sedir I do not know why it appeared ... but I fixed it by installing these packages with this version:
    gevent==1.2.2
    Eel==0.9.7
    gevent-websocket==0.10.1
    greenlet==0.4.13
    PyInstaller==3.3.1

    This also worked to me, but to clarify further for anyone else with this problem, it seems like the gevent version is the most important, and having a later version can cause problems. I was able to build but not run an EXE created with gevent==1.3.7 and after downgrading to 1.2.2 (pip install gevent==1.2.2) I was able to successfully build an EXE that ran under Windows.

    ... issue looks closed and not solved

  8. ChrisKnott commented on Feb 10, 2019

    @ChrisKnott
    Collaborator

    @3dformortals Exactly what command are you running?

  9. 3dformortals commented on Feb 10, 2019

    @3dformortals

    @3dformortals Exactly what command are you running?

    0-i am on linux
    1- i have worked done (from source) basic eel app helloworld level it just call python3 print() operator from javascript code
    https://github.com/3dformortals/data/tree/master/python/DASprogress/eel
    2- from d.py level i execute terminal command pyinstaller d.py --onefile , and all done without errors
    3- click on programm d without exe, because linux, show me nothing
    4- from d level terminal execution of ./d show me errors above

  10. ChrisKnott commented on Feb 10, 2019

    @ChrisKnott
    Collaborator

    If you use python3 -m eel instead of calling pyinstaller directly it will include things like bottle automatically. This is mentioned in the readme but not pointed out especially, quite a lot of people miss it

  11. 3dformortals commented on Feb 10, 2019

    @3dformortals

    If you use python3 -m eel instead of calling pyinstaller directly it will include things like bottle automatically. This is mentioned in the readme but not pointed out especially, quite a lot of people miss it

    how should looks final command for my d.py file? Something like
    python3 -m eel blackmagic d.py --onefile? I need executable output.

    ... looks like i found info.
    python3 -m eel d.py web --onefile, resulted executable work on linux . Now i need discover what is Promise output result from python side function to javascript, and how work with it.

  12. ChrisKnott commented on Feb 11, 2019

    @ChrisKnott
    Collaborator

    You need to either use a callback method, or await keyword to get return value from Python. There are examples in the README

  13. 3dformortals commented on Feb 11, 2019

    @3dformortals

    You need to either use a callback method, or await keyword to get return value from Python. There are examples in the README

    yep, thanx, you're right.
    var x = await pythonsidefunction()() or
    let x = await pythonsidefunction()() (let in case when i need error raising vs undefined in var case) work as expected.
    Is it possible that in the future pyinstaller d.py --onefile will work same as python3 -m eel d.py web --onefile, or i miss something etc?

  14. ChrisKnott commented on Feb 11, 2019

    @ChrisKnott
    Collaborator

    The reason for using the -m eel syntax is that it automatically includes some necessary modules that pyinstaller leaves out.

    If you look at the code you can see the actual pyinstaller command that it calls

    https://github.com/ChrisKnott/Eel/blob/master/eel/__main__.py

    I don't think pyinstaller is clever enough to know that Eel uses gevent and bottle, which is why you need the --hidden-import part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions