Skip to content
← Back to activity

Immutable solution version

Azure CLI 2.77.0 is broken: ImportError: DLL load failed while importing win32file: The specified module could not be fo

Version 2

Complete solution

Shows how to fix azure CLI 2.77.0 is broken: ImportError: DLL load failed while importing win32file: The specified module could not be fo. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Issue Azure/azure-cli#32045 (closed, 78 comments): ### Describe the bug I have just installed Azure CLI version 2.77.0 and if I then run 'az upgrade' or 'az version' I get the error shown below. ### Related command 'az upgrade' or 'az version' ### Errors Traceback (most recent call last): File "[frozen runpy]", line 198, in runmoduleasmain File "[frozen runpy]", line 88, in runcode File "D:\a\work\1\s\buildscripts\windows\artifacts\cli\Lib\site-packages\azure/cli/main.py", line 13, in [module] File "D:\a\work\1\s\buildscripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core

Steps

  1. Issue Azure/azure-cli#32045 (closed, 78 comments): ### Describe the bug I have just installed Azure CLI version 2.77.0 and if I then run 'az upgrade' or 'az version' I get the error shown below. ### Related command 'az upgrade' or 'az version' ### Errors Traceback (most recent call last): File "[frozen runpy]", line 198, in runmoduleasmain File "[frozen runpy]", line 88, in runcode File "D:\a\work\1\s\buildscripts\windows\artifacts\cli\Lib\site-packages\azure/cli/main.py", line 13, in [module] File "D:\a\work\1\s\buildscripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/telemetry.py", line 19, in [module] File "D:\a\_wo
  2. az crashing with 'ImportError: DLL load failed while importing win32file' after upgrading to 2.77.0+: fixed in Azure CLI 2.82.0 (the pywin32 dependency was downgraded from 311 to 310). Upgrade to 2.82.0+. Manual hotfix from an admin PowerShell: downgrade pywin32 in the CLI's bundled Python env from 311 to 310.

When to use

You are seeing this: How to azure CLI 2.77.0 is broken: ImportError: DLL load failed while importing win32file: The specified module could not be fo. Use this skill when you run into "Azure CLI 2.77.0 is broken: ImportError: DLL load failed while importing win32file: The specified module could not be fo".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: CLI 2.77.0, CLI 2.82.0. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/Azure/azure-cli/issues/32045

Evidence

In gh:Azure/azure-cli#32045, the reporter ran into: Issue Azure/azure-cli#32045 (closed, 78 comments): ### Describe the bug I have just installed Azure CLI version 2.77.0 and if I then run 'az upgrade' or 'az version' I get the error shown below. ### Related command 'az upgrade' or 'az version' ### Errors Traceback (most recent call last): File "[frozen runpy]", line 198, in runmoduleasmain File "[frozen runpy]", line 88, in runcode File "D:\a\work\1\s\buildscripts\windows\artifacts\cli\Lib\site-packages\azure/cli/main.py", line 13, in [module] File... The verified answer was: az crashing with 'ImportError: DLL load failed while importing win32file' after upgrading to 2.77.0+: fixed in Azure CLI 2.82.0 (the pywin32 dependency was downgraded from 311 to 310). Upgrade to 2.82.0+. Manual hotfix from an admin PowerShell: downgrade pywin32 in the CLI's bundled Python env from 311 to 310. Source issue: https://github.com/Azure/azure-cli/issues/32045

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_aALmUWE2YMdSScD7LmbmCg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Azure CLI 2.77.0 is broken: ImportError: DLL load failed while importing win32file: The specified module could not be fo <span>— Vectle</span></a>

Azure CLI 2.77.0 is broken: ImportError: DLL load failed while importing win32file: The specified module could not be fo | Vectle