takluyver / pynsist

Build Windows installers for Python applications
https://pynsist.readthedocs.io/
Other
883 stars 119 forks source link

pywin32 - DLL load failed: The specified module could not be found #197

Closed JOJ0 closed 4 years ago

JOJ0 commented 4 years ago

Hi, I am not sure if this is a problem with pywin32 or with pynsist. I assume people use pywin32 often when packaging software for windows (eg with pynsist) and probably this is a common issue and you might know what's the problem right away.

I include the wheel in installer.cfg:

    pywin32==228
C:\Users\User>disco
Traceback (most recent call last):
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 193, in _run_module_as_main
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 85, in _run_code
  File "C:\Users\User\AppData\Local\DiscoDOS\bin\disco.exe\__main__.py", line 17, in <module>
  File "C:\Users\User\AppData\Local\DiscoDOS\pkgs\discodos\__init__.py", line 2, in <module>
    log=log.logger_init()
  File "C:\Users\User\AppData\Local\DiscoDOS\pkgs\discodos\log.py", line 18, in logger_init
    discodos_data = create_data_dir(discodos_root)
  File "C:\Users\User\AppData\Local\DiscoDOS\pkgs\discodos\config.py", line 23, in create_data_dir
    import win32com.client
  File "C:\Users\User\AppData\Local\DiscoDOS\pkgs\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.

I did google a lot about this error already and there where issues in the package pywin32, yes, but it seems they are fixed already. I don't have issues when I try to use pywin32 on my packaging system in an interactive python shell.

Hope this is an easy one for you, because I am a little frustrated with this already. I also tried using pywin32 version 223 and using pypiwin32 as other suggested but I think all this doesn't help because it where fixes with pywin32 itself. I seem to have something else just happening when packaging. Not sure.....

I am on Windows 10 and Python 3.7.7.

Thanks a lot in advance Jojo

takluyver commented 4 years ago

Sorry, it's actually something I don't know much about. I'm don't use Windows myself, and when I do package applications for it, I tend to prefer cross-platform APIs like PyQt to anything platform specific.

Unfortunately that error message 'The specified module could not be found' is spectacularly unhelpful: it doesn't tell you which DLL it failed to find. The only way I know to investigate is to use https://www.dependencywalker.com/ to inspect the relevant .dll & .pyd files and try to work out what's missing.

JOJ0 commented 4 years ago

Hi, thanks a lot for getting back to me so quickly! I fell you, I don't use it myself often too. Just packaging my software for it ;-) pynsist is a great tool btw! Exactely what I was looking for. Very easy to configure and a classic installer as one would expect on Windows. Nice!

In the meantime I worked around the problem. Actually I just wanted to find out what the users "My Documents" folder is and pywin32 was what a lot of people suggested as the best way. I now use something that's deprecated by Microsoft already but it works for now and should be sufficient: https://stackoverflow.com/a/3859336. Maybe somebody else will find it useful too.

Please close this one. Thanks a lot again!

takluyver commented 4 years ago

Fair enough, thanks for following up.

I've made the title a bit more searchable for future readers. There may still be something to be fixed - possibly related to the dreaded MSVCRT issue discussed in #176. But I'll close this one as there isn't enough information to work out what's causing the problem.