Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLL load failed on Python 3.4b1 #661

Closed
ghost opened this issue Dec 12, 2013 · 10 comments
Closed

DLL load failed on Python 3.4b1 #661

ghost opened this issue Dec 12, 2013 · 10 comments

Comments

@ghost
Copy link

ghost commented Dec 12, 2013

I've installed pywin32 218 for amd64, but after installing, import win32com yields:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python\lib\site-packages\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.

This is on Python 3.4b1 64-bit. I suspect this is simply an API incompatibility with the early-compiled release for 3.4. Is a new release required, or is the current 218 release expected to work with 3.4b1?

Reported by: jaraco

Original Ticket: pywin32/bugs/661

@ghost
Copy link
Author

ghost commented Dec 13, 2013

Digging into the issue a bit, I inspected the .pyd file with Dependency Walker and found that it's unable to load pywintypes34.dll. I see that file is installed at $Lib/site-packages/pywin32_system32.

Doing a search around, it appears the issue is that the post install isn't being invoked. Perhaps I'm not invoking the installer with the proper privileges.

Original comment by: jaraco

@ghost
Copy link
Author

ghost commented Dec 13, 2013

I ran the installer using "Run as Administrator" from Windows explorer, and it seemed to install just fine this time. Sorry for the noise.

Original comment by: jaraco

@ghost
Copy link
Author

ghost commented Dec 16, 2013

The problem has re-emerged, apparently spontaneously. I uninstalled and re-installed (again using Run as Administrator), and the problem persists.

Original comment by: jaraco

@ghost
Copy link
Author

ghost commented Dec 16, 2013

I was able to work around the issue by running pywin32_postinstall.py -install; I won't be surprised if the issue arises again. I'm using Windows 8.1. Perhaps it has some protections against installing files to System32?

Original comment by: jaraco

@ghost
Copy link
Author

ghost commented Mar 18, 2014

I just ran into the same issue using the just officially released python 3.4.0 64 bit version. I am also using Windows 8.1 64 bit. The workaround by J. Coombs also worked for me. Other than that I had to revert to python 3.3.5 with the pywin32 3.3 extensions to use win32com; I don't have the python working skills to add much more information than a confirmation of the problem.

Original comment by: garydyr

@ghost
Copy link
Author

ghost commented Mar 18, 2014

In case it's relevant, with a non-official installer (from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32 ), I had this symptom on Windows 7 x64 using Python 3.4.0 32 bit:

set PATH=C:\Python34\Scripts;C:\Python34;C:\Windows;C:\Windows\System32
C:\Python34\python -E -c "import win32com"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python34\lib\site-packages\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.

I tried running the installer using "Run as administrator" didn't help. I finally just copied the files:

copy C:\Python34\lib\site-packages\pywin32_system32\py*.dll C:\Python34

Original comment by: mdengler

@ghost
Copy link
Author

ghost commented Mar 23, 2014

I have the same problem with the win32 official build for 3.4.0 on Windows 7 64 bit. Installing pywin32 as administrator did not solve it, but running pywin32_postinstall.py -install as suggested did.

Original comment by: nmusatti

@ghost
Copy link
Author

ghost commented Sep 16, 2014

EDIT: Accidentally left this comment on the wrong page... sorry

Original comment by: flutefreak7

@ghost ghost assigned ghost and unassigned ghost Oct 24, 2017
@Avasam
Copy link
Collaborator

Avasam commented Mar 16, 2024

Tagging @jaraco as the original SourceForge issue creator.

@Avasam
Copy link
Collaborator

Avasam commented Mar 17, 2024

Since 71afa71, the PATH is now prepended, rather than appended. For Python >= 3.8, the PATH environment variable isn't even used. This is included in pywin32==226.

Python 3.7 has also reached EOL (meaning no security fixes/support) and I'd recommend migrating over to 3.8+ (see #2207)

.exe installers are now deprecated #1939, so you should install from PyPI (ie: pip install pywin32>=226)

Given the sheer amount of "ImportError: DLL load failed" issue duplication and old history, I'd like to consolidate the current state of these issues. So I'll close and reference back any issue that only has comments showing the issue:

  • from before November 10th, 2019 (pywin32<226)
  • using .exe installers
  • using Python < 3.8

Please also try https://github.com/mhammond/pywin32#troubleshooting before opening a new issue, or let us, and others, know if it did fix your issue.

@Avasam Avasam closed this as completed Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant