azure-cli: DLL load failed while importing win32file: The specified module could not be found.
az feedback
auto-generates most of the information requested below, as of CLI version 2.0.62
Describe the bug
DLL load failed while importing win32file: The specified module could not be found.
To Reproduce
Any az command, az --version, give no version or regular feedback. I get…
DLL load failed while importing win32file: The specified module could not be found. The command failed with an unexpected error. Here is the traceback: DLL load failed while importing win32file: The specified module could not be found. Traceback (most recent call last): File “D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py”, line 223, in invoke File “D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/init.py”, line 125, in show_version File “D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py”, line 345, in get_az_version_string File “D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py”, line 332, in _get_local_versions File “D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py”, line 256, in get_installed_cli_distributions File “D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/telemetry/init.py”, line 9, in <module> File “D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\portalocker/init.py”, line 4, in <module> File “D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\portalocker/portalocker.py”, line 9, in <module> ImportError: DLL load failed while importing win32file: The specified module could not be found
Expected behavior
version information displayed
Environment summary
auto updated using windows MSI
Additional context
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 12
- Comments: 22 (5 by maintainers)
I was able to solve it by reinstalling
pywin32
with a terminal “Run as Administrator”:Though the root cause remains unknown…
Deleted C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2 Installed latest version.
All seems to be fine.
@jiasli This worked for me.
Deleted
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2
and repaired the Azure CLI installation.As a fresh installation works fine, it’s very likely some remnants of the old installation are interfering with the latest version. Another solution worth trying is to
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2
Please kindly let us know if it solves the issue.
When installing the CLI via python, uninstalling and reinstalling does not resolve this issue.
Why is this closed? the issue still exists, I assume customer find a workaround does not mean the issue is fixed.
This fix worked for me. Thank you @jiasli!