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

pywin32_postinstall.py fails (DLL load failure) with Microsoft Store's Python #1383

Open
NathanZook opened this issue Aug 1, 2019 · 10 comments

Comments

@NathanZook
Copy link

Running Windows 10 in a VM. Python 3.7.4 installed from App Store.

As administrator:

pip install pywin32
Downloading https://files.pythonhosted.org/packages/a3/8a/eada1e7990202cd27e58eca2a278c344fef190759bbdc8f8f0eb6abeca9c/pywin32-224-cp37-cp37m-win_amd64.whl (9.0MB)
100% |████████████████████████████████| 9.1MB 2.8MB/s
Installing collected packages: pywin32
Successfully installed pywin32-224
You are using pip version 19.0.3, however version 19.2.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

python pywin32_postinstall.py -install
pywin32_postinstall.py:156: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "pywin32_postinstall.py", line 605, in
install()
File "pywin32_postinstall.py", line 328, in install
LoadSystemModule(lib_dir, "pywintypes")
File "pywin32_postinstall.py", line 166, in LoadSystemModule
mod = imp.load_dynamic(modname, filename)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1264.0_x64__qbz5n2kfra8p0\lib\imp.py", line 342, in load_dynamic
return _load(spec)
File "", line 696, in _load
File "", line 670, in _load_unlocked
File "", line 583, in module_from_spec
File "", line 1043, in create_module
File "", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

Note: there is a space in my user name. Is it possible that this is an issue?

@mhammond
Copy link
Owner

mhammond commented Aug 2, 2019

I doubt the space in the name is an issue, and I can't think of what might be going wrong. My best guess is that the version from the app store is laid out slightly differently - I'll try and test this ASAP.

@thopiekar
Copy link
Contributor

I can imagine that the problem is solved when applying the corrections I made to get the CI tests working.
@mhammond Guess we need to find some time to discuss how to merge my efforts. I think email will be best again. How about continuing our last conversation? 😃

@mhammond
Copy link
Owner

Sorry for the delay, but I was away last week with work (chewing 2 weekends!) and am away this weekend for family - but I will get back to all of this as I can!

@nk00li
Copy link

nk00li commented Sep 27, 2019

I had an issue installing the xlwings addin, until I figured out the DLL error issue I was experiencing is related to this issue. I also have installed Python 3.7.4 from App Store.

@buckyball99
Copy link

I have the exact same issue, did anyone find a solution?

This is my terminal Output, when using a Conda Env installed in a separate 'Z' Drive:

(tfdeeplearning) C:\Users\harsh\Documents\6th Sem\Coursera Udemy\Data Science and ML Visualization>python C:\Users\harsh\AppData\Roaming\Python\Python35\Scripts\pywin32_postinstall.py -install Parsed arguments are: Namespace(destination='Z:\\Anaconda\\envs\\tfdeeplearning\\Lib\\site-packages', install=True, quiet=False, remove=False, silent=False, wait=None) Traceback (most recent call last): File "C:\Users\harsh\AppData\Roaming\Python\Python35\Scripts\pywin32_postinstall.py", line 633, in <module> install(args.destination) File "C:\Users\harsh\AppData\Roaming\Python\Python35\Scripts\pywin32_postinstall.py", line 334, in install LoadSystemModule(lib_dir, "pywintypes") File "C:\Users\harsh\AppData\Roaming\Python\Python35\Scripts\pywin32_postinstall.py", line 174, in LoadSystemModule mod = imp.load_dynamic(modname, filename) File "Z:\Anaconda\envs\tfdeeplearning\lib\imp.py", line 343, in load_dynamic return _load(spec) File "<frozen importlib._bootstrap>", line 693, in _load File "<frozen importlib._bootstrap>", line 666, in _load_unlocked File "<frozen importlib._bootstrap>", line 577, in module_from_spec File "<frozen importlib._bootstrap_external>", line 938, in create_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed ImportError: DLL load failed: The specified module could not be found.

@mhammond
Copy link
Owner

There is almost certainly a dupe of pywintypes35.dll and that's being loaded instead of the expected one.

@nilch
Copy link

nilch commented Jul 26, 2020

Yep, same issue here (can't complete the post install). Had a look round for duplicate pywintypes files and couldn't find any. Is there anywhere these would be normally?

I also got Python from the windows app store. I might try another version as a troubleshoot soon.

@nilch
Copy link

nilch commented Jul 30, 2020

Yep installing from here https://www.python.org/downloads/ works for me.

@wescpy
Copy link

wescpy commented Sep 30, 2023

Can confirm this issue is still happening today (2023) with Python 3.11.5. Running the post-installer fails similarly if you installed Python from the Microsoft app store but succeeds if you use the binary installer at http://python.org/getit/windows.

@Avasam
Copy link
Collaborator

Avasam commented Mar 17, 2024

@wescpy @nk00li Which version of pywin32 are you using? And how did you install it? (pip install vs standalone .exe)


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: The specified module could not be found." issue duplication and old history, I'd like to consolidate the current state of these issues.

Now there's an additional detail from this specific thread that the Python install from the Microsoft App store seems to be causing issues over a regular install, making even the postinstall script fail.

@Avasam Avasam changed the title pywin32_postinstall.py fails (DLL load failure) pywin32_postinstall.py fails (DLL load failure) with Microsoft Store's Python Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants