brentvollebregt / auto-py-to-exe

Converts .py to .exe using a simple graphical interface
MIT License
3.91k stars 675 forks source link

DLL load failed while importing _greenlet #325

Closed kurte32 closed 1 year ago

kurte32 commented 1 year ago

I have used auto-py-to-exe several time in the past with great results, however been having this issue for the last couple of days and I have not been able to fix it/found a fix I have tried the 3 methods of installation (PyPI, Install GitHub, and Running Locally) both in a VirtualEnv and Global, however I keep getting the same error.

I have also changed my Python version, started with 3.11 and went all the way to 3.8.10, updated my OS, but ran out of luck

py -m auto_py_to_exe
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\kurt\Documents\FacturaParque\auto-py-to-exe\auto_py_to_exe\__main__.py", line 10, in <module>
    from . import ui
  File "C:\Users\kurt\Documents\FacturaParque\auto-py-to-exe\auto_py_to_exe\ui.py", line 5, in <module>
    import eel
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Program Files\Python38\lib\site-packages\eel-0.14.0-py3.8.egg\eel\__init__.py", line 5, in <module>
  File "C:\Program Files\Python38\lib\site-packages\gevent\__init__.py", line 86, in <module>
    from gevent._hub_local import get_hub
  File "C:\Program Files\Python38\lib\site-packages\gevent\_hub_local.py", line 101, in <module>
    import_c_accel(globals(), 'gevent.__hub_local')
  File "C:\Program Files\Python38\lib\site-packages\gevent\_util.py", line 148, in import_c_accel
    mod = importlib.import_module(cname)
  File "C:\Program Files\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "src\\gevent\\_hub_local.py", line 1, in init gevent._gevent_c_hub_local
  File "C:\Program Files\Python38\lib\site-packages\greenlet\__init__.py", line 29, in <module>
    from ._greenlet import _C_API # pylint:disable=no-name-in-module
ImportError: DLL load failed while importing _greenlet: The specified module could not be found.

auto_py_to_exe

brentvollebregt commented 1 year ago

This definitely looks less like bug and more like an environment issue.

If you open up a python shell in one of these virtual environments and execute import eel - do you get the same error?

richylyq commented 1 year ago

I am also facing the similar issue of DLL not found for another library. If I open the python shell in a virtual environment and execute the import statement, it works perfectly fine, only after building the .exe and the error shows up

Traceback (most recent call last):
  File "PDFNetPython.py", line 14, in swig_import_helper
  File "importlib\__init__.py", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 556, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1101, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed while importing _PDFNetPython: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gui.py", line 17, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "dpf_main.py", line 1, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "PDFNetPython3\__init__.py", line 18, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "PDFNetPython.py", line 17, in <module>
  File "PDFNetPython.py", line 16, in swig_import_helper
  File "importlib\__init__.py", line 127, in import_module
ImportError: DLL load failed while importing _PDFNetPython: The specified module could not be found.
brentvollebregt commented 1 year ago

@richylyq your issue is in the output executable whereas the problem in this issue is regarding running auto-py-to-exe (missing dll in a dependency).

If you want to report this, you could create a new issue and fill out the template.

knsonier commented 1 year ago

@kurte32, I had this same exception happen to me on both a Windows 10 and Windows 11 VM. Are you sure you have the Visual C++ Redistributable Packages installed? This fixed the problem for me.

I downloaded version 14 from here: https://www.microsoft.com/en-ca/download/details.aspx?id=48145

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.

kurte32 commented 1 year ago

@kurte32, I had this same exception happen to me on both a Windows 10 and Windows 11 VM. Are you sure you have the Visual C++ Redistributable Packages installed? This fixed the problem for me.

I downloaded version 14 from here: https://www.microsoft.com/en-ca/download/details.aspx?id=48145

Hi, just came back to say thanks, this worked :)

QuinnCiccoretti commented 1 year ago

@kurte32, I had this same exception happen to me on both a Windows 10 and Windows 11 VM. Are you sure you have the Visual C++ Redistributable Packages installed? This fixed the problem for me.

I downloaded version 14 from here: https://www.microsoft.com/en-ca/download/details.aspx?id=48145

You are the GOAT