azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Seems like there is an issue i'm getting this error while deploying [WinError 193] %1 is not a valid Win32 application

Open gopisettyr opened this issue 5 years ago • 9 comments

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az bicep upgrade

Errors:

The command failed with an unexpected error. Here is the traceback:
[WinError 193] %1 is not a valid Win32 application
Traceback (most recent call last):
  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
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3418, in upgrade_bicep_cli
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 93, in ensure_bicep_installation
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 171, in _get_bicep_installed_version
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 205, in _run_command
  File "subprocess.py", line 493, in run
  File "subprocess.py", line 858, in __init__
  File "subprocess.py", line 1311, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az bicep upgrade

Expected Behavior

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.26.1

Additional Context

gopisettyr avatar Jul 18 '21 11:07 gopisettyr

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure.

Issue Details

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az bicep upgrade

Errors:

The command failed with an unexpected error. Here is the traceback:
[WinError 193] %1 is not a valid Win32 application
Traceback (most recent call last):
  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
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3418, in upgrade_bicep_cli
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 93, in ensure_bicep_installation
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 171, in _get_bicep_installed_version
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 205, in _run_command
  File "subprocess.py", line 493, in run
  File "subprocess.py", line 858, in __init__
  File "subprocess.py", line 1311, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az bicep upgrade

Expected Behavior

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.26.1

Additional Context

Author: gopisettyr
Assignees: -
Labels:

ARM, Service Attention

Milestone: -

ghost avatar Jul 18 '21 15:07 ghost

route to service team

yonzhan avatar Jul 18 '21 15:07 yonzhan

Hi @gopisettyr, thanks for bringing this up.

When you check your PATH variable ($Env:PATH in PowerShell, for example) - do you see a path listed that contains a python executable (something like D:\Python38\)?

snaheth avatar Aug 14 '21 23:08 snaheth

Has their been any progress on this? I am receiving the same error when running any bicep commands on the Az CLI such as

  • az bicep version
  • az deployment group create
  • az bicep build
The command failed with an unexpected error. Here is the traceback:
[WinError 193] %1 is not a valid Win32 application
Traceback (most recent call last):
  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
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3568, in show_bicep_cli_version
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 69, in run_bicep_command
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 181, in _get_bicep_installed_version
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 215, in _run_command
  File "subprocess.py", line 493, in run
  File "subprocess.py", line 858, in __init__
  File "subprocess.py", line 1311, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application

I have tried uninstalling & re-installing both Az CLI and bicep but still receive the same issue

danponting avatar Oct 21 '21 08:10 danponting

Hi @gopisettyr, could you confirm if you are still getting this error? Did you try running the same command in the latest version of Azure CLI?

shenglol avatar Oct 23 '21 00:10 shenglol

I'm having the same issue using the latest version

{ "azure-cli": "2.30.0", "azure-cli-core": "2.30.0", "azure-cli-telemetry": "1.0.6", "extensions": {} }

sosoriov avatar Nov 10 '21 08:11 sosoriov

We get it when using az bicep publish --file --target "br:.azurecr.io/bicep/modules/:0.1.3r" through Octopus Deploy, but not if I run it directly. { "azure-cli": "2.34.1", "azure-cli-core": "2.34.1", "azure-cli-telemetry": "1.0.6", "extensions": {} }

Bicep CLI version 0.4.1318 (ee0d808f35)

Update: After further investigation our problem was caused by az bicep is a per-user installation - so the error we got was basically a very bad way of saying bicep was not installed in that service accounts context, instead of saying "you are trying to run bicep but it's not installed"

AGregersen avatar Mar 21 '22 05:03 AGregersen

Hi @gopisettyr, thanks for bringing this up.

When you check your PATH variable ($Env:PATH in PowerShell, for example) - do you see a path listed that contains a python executable (something like D:\Python38\)?

Yes. I have Python 3.9.5 and 2.7.17 installed already and added to PATH, prior to installing BICEP. I can see there're Python related files under 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2', but not sure if I should add that to PATH because that would probably conflict with my other Python paths?

UPDATE:

NVM, issue is unrelated to existing Python installs. Just had to follow this instruction here: https://github.com/Azure/bicep/issues/2364#issuecomment-825049091

chaoscreater avatar Mar 27 '22 09:03 chaoscreater

This worked for me.

az bicep uninstall
az bicep install

rahulwaghule avatar Feb 05 '26 11:02 rahulwaghule