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 while importing win32file: The specified module could not be found. #17986

Closed
SenseiJoe opened this issue May 6, 2021 · 22 comments · Fixed by #18012
Closed
Assignees
Labels
Core CLI core infrastructure
Milestone

Comments

@SenseiJoe
Copy link

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
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\portalocker/init.py", line 4, in
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\portalocker/portalocker.py", line 9, in
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

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 6, 2021
@turb0chrg
Copy link

turb0chrg commented May 6, 2021

Getting the same. Upgraded using chocolately from 2.20.0. 2.23.0 was released today...

Installed 2.22.1 and it works as expected:

azure-cli                         2.22.1 *

core                              2.22.1 *
telemetry                          1.0.6

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\joel.carter\.azure\cliextensions'

Python (Windows) 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal


You have 2 updates available. Consider updating your CLI installation with 'az upgrade'

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy

@yonzhan yonzhan added the Core CLI core infrastructure label May 6, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label May 6, 2021
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label May 6, 2021
@yonzhan yonzhan added this to the S187 milestone May 6, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented May 6, 2021

@jiasli for awareness

@SenseiJoe
Copy link
Author

Re-installed 2.22.1 and things all work better

@yonzhan yonzhan closed this as completed May 7, 2021
@SenseiJoe
Copy link
Author

Why is this closed?

@yonzhan
Copy link
Collaborator

yonzhan commented May 7, 2021

I assumed that you issue was resolved by yourself? If not, I will reopen it. Sorry for the misunderstanding.

@yonzhan yonzhan reopened this May 7, 2021
@pazdedav
Copy link

pazdedav commented May 7, 2021

Same issue here. It is not just az --version command that fails, when I try e.g. az group list -o table, it first returns "DLL load failed while importing win32file: The specified module could not be found.", but after that it lists my resource groups correctly.

It seems there is something wrong with the build process and the way the packages are either referenced (paths with both types of slashes) or made available in the build agent:

File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute

@ryanbowden
Copy link

Same issue here :(

@aldodfm
Copy link

aldodfm commented May 7, 2021

+1

@jiasli
Copy link
Member

jiasli commented May 7, 2021

I am able to repo on my local machine. It seems to be related to #17816, triggering mhammond/pywin32#1431.

Investigating... 👨‍💻

@tirendra-reddy
Copy link

Not a problem, Thank you :) I will subscribe to that thread and follow it there.

@SenseiJoe
Copy link
Author

I downgraded to solve the problem, it wasn't actually fixed.
@pazdedav is correct, it happens more than az --version.

@richardg1
Copy link

Same issue, not just a problem with az version. Uninstalling 2.23.0, installed 2.22.1 and working OK now.

@jiasli
Copy link
Member

jiasli commented May 7, 2021

I was able to solve it by reinstalling pywin32 with a terminal "Run as Administrator":

& "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe" -m pip install pywin32==228 --force-reinstall

Though the root cause remains unknown...

@jiasli
Copy link
Member

jiasli commented May 7, 2021

Unable to repro when installing 2.23.0 on a fresh Azure Virtual Machine. Also tried in-place upgrade from 2.22.1 to 2.23.0, but still can't repro:

image

@tirendra-reddy
Copy link

I was able to solve it by reinstalling pywin32 with a terminal "Run as Administrator":

& "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe" -m pip install pywin32==228 --force-reinstall

Though the root cause remains unknown...

This fix worked for me. Thank you @jiasli!

@jiasli
Copy link
Member

jiasli commented May 7, 2021

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

  1. Go to Control Panel > Uninstall a program , uninstall Microsoft Azure CLI
  2. Delete C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2
  3. Install the latest Azure CLI from scratch

Please kindly let us know if it solves the issue.

@EvanMulawski
Copy link

@jiasli This worked for me.

Deleted C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2 and repaired the Azure CLI installation.

@SenseiJoe
Copy link
Author

Deleted C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2
Installed latest version.

All seems to be fine.

@dawwa
Copy link

dawwa commented May 21, 2021

Why is this closed? the issue still exists, I assume customer find a workaround does not mean the issue is fixed.

@thoemmi
Copy link

thoemmi commented May 22, 2021

@dawwa I'd guess @jiasli closed this issue because it was fixed in #18012

@jiasli
Copy link
Member

jiasli commented May 24, 2021

I am not able to precisely identify the root cause. Hopefully #18012 can fix it.

Reinstalling is the official fix instead of a workaround. Thanks for understanding.

@tarockey
Copy link

When installing the CLI via python, uninstalling and reinstalling does not resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core CLI core infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.