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

[Errno 86] Bad CPU type in executable: '/Users/user/.azure/bin/bicep'

Open fedesardo opened this issue 4 years ago • 9 comments

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Related command

Describe the bug

Unable to execute az commands in mac m1 Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 3705, in show_bicep_cli_version print(run_bicep_command(["--version"], auto_install=False)) File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 75, in run_bicep_command installed_version = _get_bicep_installed_version(installation_path) File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 203, in _get_bicep_installed_version installed_version_output = _run_command(bicep_executable_path, ["--version"]) File "/opt/homebrew/Cellar/azure-cli/2.42.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 241, in _run_command process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 503, in run with Popen(*popenargs, **kwargs) as process: File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 971, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1847, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 86] Bad CPU type in executable: '/Users/fsardo/.azure/bin/bicep'

We appreciate your feedback!

For more information on getting started, visit: aka.ms/azcli/get-started If you have questions, visit our Stack Overflow page: aka.ms/azcli/questions

Recent commands:

[0] create a generic issue. [1] az configure : SUCCESS. Ran: 2 hrs 47 mins ago. [2] az deployment group create: FAILURE. Ran: 2 hrs 46 mins ago. [3] az deployment group create: FAILURE. Ran: 2 hrs 30 mins ago. [4] az upgrade : SUCCESS. Ran: 2 hrs 02 mins ago. [5] az version : SUCCESS. Ran: 2 hrs 02 mins ago. [6] az bicep upgrade : FAILURE. Ran: 29 mins ago.
[7] az deployment group create: FAILURE. Ran: 24 mins ago.
[8] az bicep version : FAILURE. Ran: 19 mins ago.
[9] az bicep version : FAILURE. Ran: 16 mins ago.

fedesardo avatar Dec 01 '22 17:12 fedesardo

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Dec 01 '22 23:12 ghost

route to CXP team

yonzhan avatar Dec 01 '22 23:12 yonzhan

@fedesardo Apologies for the late reply. Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.

navba-MSFT avatar Dec 14 '22 03:12 navba-MSFT

@fedesardo Could you please answer the below questions ?

  1. What is the CPU arch type of your M1 Mac ? Is it x64 or ARM64 ?
  2. How did you install the bicep ?
  3. Which bicep AzCLI command did you execute ? Awaiting your reply.

navba-MSFT avatar Dec 14 '22 05:12 navba-MSFT

@fedesardo I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know if you had any updates on this. Awaiting your reply.

navba-MSFT avatar Dec 16 '22 03:12 navba-MSFT

@fedesardo The action is currently pending on you to check the above questions and share an update. Once you are ready to resume troubleshooting on this, please feel free to reopen this thread. We would be happy to help.

navba-MSFT avatar Dec 21 '22 04:12 navba-MSFT

Hi @navba-MSFT

What is the CPU arch type of your M1 Mac ? Is it x64 or ARM64 ? --> Mi chip is Apple M1 Pro so I guess is ARM How did you install the bicep ? --> I followed the steps from here https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/install Which bicep AzCLI command did you execute ? Awaiting your reply. --> I followed the steps in the link from the previous question.

This is the full response of az bicep version command

Your CLI is up-to-date. fsardo@MBP-de-Federico ~ % az bicep version
The command failed with an unexpected error. Here is the traceback: [Errno 86] Bad CPU type in executable: '/Users/fsardo/.azure/bin/bicep' Traceback (most recent call last): File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 3708, in show_bicep_cli_version print(run_bicep_command(["--version"], auto_install=False)) File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 75, in run_bicep_command installed_version = _get_bicep_installed_version(installation_path) File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 203, in _get_bicep_installed_version installed_version_output = _run_command(bicep_executable_path, ["--version"]) File "/opt/homebrew/Cellar/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 241, in _run_command process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 503, in run with Popen(*popenargs, **kwargs) as process: File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 971, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1847, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 86] Bad CPU type in executable: '/Users/fsardo/.azure/bin/bicep' To check existing issues, please visit: https://github.com/Azure/azure-cli/issues To open a new issue, please run az feedback fsardo@MBP-de-Federico ~ %

fedesardo avatar Jan 15 '23 15:01 fedesardo

I'm having a similar issue, but am unable to re-open it @navba-MSFT.

I have a Macbook Air M2, which is an ARM CPU. I don't have the Rosetta 2 emulator installed on my system.

Describe the bug

Most az bicep sub commands fails with the error:

[Errno 86] Bad CPU type in executable: '/Users/sindre/.azure/bin/bicep'

Command Name az bicep version

Errors:

❯ az bicep version
The command failed with an unexpected error. Here is the traceback:
[Errno 86] Bad CPU type in executable: '/Users/sindre/.azure/bin/bicep'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 4401, in show_bicep_cli_version
    print(run_bicep_command(cmd.cli_ctx, ["--version"], auto_install=False))
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 94, in run_bicep_command
    installed_version = _get_bicep_installed_version(installation_path)
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 267, in _get_bicep_installed_version
    installed_version_output = _run_command(bicep_executable_path, ["--version"])
  File "/opt/homebrew/Cellar/azure-cli/2.52.0_1/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 305, in _run_command
    process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 503, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 86] Bad CPU type in executable: '/Users/sindre/.azure/bin/bicep'

To Reproduce:

  • Installed Az Cli using homebrew: brew update && brew install azure-cli
  • Ran az deployment sub create (...) It installed Bicep CLI v0.21.1. and failed with the error: [Errno 86] Bad CPU type in executable: '/Users/sindre/.azure/bin/bicep'
  • Ran az bicep version It printed the same error and the traceback pasted above.

Expected Behavior

To simply print the Bicep version.

Environment Summary

macOS-13.5.2-arm64-arm-64bit, Darwin 22.6.0
Python 3.10.13
Installer: HOMEBREW

azure-cli 2.52.0

sindkor avatar Sep 13 '23 07:09 sindkor

Apparently, it defaults to installing the x86_64-version. From https://github.com/Azure/azure-cli/issues/25785#issuecomment-1466966885:

# For Install
az bicep install --target-platform osx-arm64

# For Upgrade
az bicep upgrade --target-platform osx-arm64

sindkor avatar Sep 14 '23 07:09 sindkor