Azure / azure-cli

Azure Command-Line Interface
MIT License
3.98k stars 2.96k forks source link

az aks create failes with error message No module named '_cffi_backend' #29052

Open locmer opened 4 months ago

locmer commented 4 months ago

Describe the bug

az aks create failes with error message No module named '_cffi_backend'

Related command

az aks create --resource-group RLk8sRG --name RLAKSCluster --node-count 1 --enable-addons monitoring --generate-ssh-keys

Errors

The command failed with an unexpected error. Here is the traceback: No module named '_cffi_backend' Traceback (most recent call last): File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 561, in execute self.commands_loader.load_arguments(command) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/init.py", line 515, in load_arguments self.command_table[command].load_arguments() # this loads the arguments via reflection File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 318, in load_arguments super(AzCliCommand, self).load_arguments() File "/usr/lib64/az/lib/python3.6/site-packages/knack/commands.py", line 104, in load_arguments cmd_args = self.arguments_loader() File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader op = self.get_op_handler(self.op_path) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler handler = import_module(mod_to_import) File "/usr/lib64/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 37, in from azure.cli.command_modules.acs import acs_client, proxy File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/acs/acs_client.py", line 13, in import paramiko File "/usr/lib64/az/lib/python3.6/site-packages/paramiko/init.py", line 22, in from paramiko.transport import SecurityOptions, Transport File "/usr/lib64/az/lib/python3.6/site-packages/paramiko/transport.py", line 91, in from paramiko.dsskey import DSSKey File "/usr/lib64/az/lib/python3.6/site-packages/paramiko/dsskey.py", line 37, in from paramiko.pkey import PKey File "/usr/lib64/az/lib/python3.6/site-packages/paramiko/pkey.py", line 31, in import bcrypt File "/usr/lib64/az/lib/python3.6/site-packages/bcrypt/init.py", line 25, in from . import _bcrypt # type: ignore ModuleNotFoundError: No module named '_cffi_backend'

Issue script & Debug output

See above

Expected behavior

The command should work or provide normal error message

Environment Summary

[azureuser@AKSClient2 ~]$ az version { "azure-cli": "2.38.1", "azure-cli-core": "2.38.1", "azure-cli-telemetry": "1.0.6", "extensions": {} }

Additional context

No response

azure-client-tools-bot-prd[bot] commented 4 months ago

Hi @locmer,

2.38.1 is not the latest Azure CLI(2.61.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

azure-client-tools-bot-prd[bot] commented 4 months ago
Hi @locmer Find similar issue https://github.com/Azure/azure-cli/issues/17329.
Issue title errors while attemptin to install azure cli via "az aks install-cli"
Create time 2021-03-16
Comment number 3

Possible solution: According to the previous issue, Azure CLI's RPM package doesn't work correctly with Python 3.8.7. The error message "No module named '_cffi_backend'" is caused by a missing dependency. The solution is to install the missing dependency by running the following command: "sudo yum install -y python3-cffi". After installing the missing dependency, you should be able to run the "az aks create" command without any issues.


Please confirm if this resolves your issue.

yonzhan commented 4 months ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 4 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dyu1208, @FumingZhang, @andyliuliming.

microsoft-github-policy-service[bot] commented 4 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dyu1208, @FumingZhang, @andyliuliming.

FumingZhang commented 4 months ago

@locmer, may try to install the missing package to solve the issue

python3 -m pip install cffi

But if possible, I recommend you to update the versions of Python (from 3.6 to 3.11) and Azure-CLI (from 2.38.1 to 2.61.0) you use

locmer commented 4 months ago

At first I didn't realise why I got stuck with old versions of everything but then it dawned on me. I used chat-gpt to create me a list of commands to step az cli and aks cluster setup. Since this is likely trained on slightly older data...I get older install instructions. This is a first for me realizing this danger to the approach... All cleaned up now az , python and all upgraded and point to the newer repository (I had the latest of old repositories.... hence updates didn't do anything) All sorted.