Azure / azure-cli

Azure Command-Line Interface
MIT License
4.02k stars 2.99k forks source link

az ssh vm/config give errors when connecting `ModuleNotFoundError: No module named 'rpds.rpds'` #29938

Open Geertvdc opened 1 month ago

Geertvdc commented 1 month ago

Describe the bug

When trying to connect a ssh session to a Azure VM az cli it just crashes with an error ModuleNotFoundError: No module named 'rpds.rpds'

Related command

az ssh vm az ssh config

the arguments passed into this after do not matter. ANYTHING results in below error

Errors

The command failed with an unexpected error. Here is the traceback:
No module named 'rpds.rpds'
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/__init__.py", line 526, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 321, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/az/lib/python3.11/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/root/.azure/cliextensions/ssh/azext_ssh/custom.py", line 20, in <module>
    from . import rdp_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/rdp_utils.py", line 19, in <module>
    from . import ssh_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/ssh_utils.py", line 20, in <module>
    from . import connectivity_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/connectivity_utils.py", line 10, in <module>
    import oras.client
  File "/root/.azure/cliextensions/ssh/oras/client.py", line 12, in <module>
    import oras.provider
  File "/root/.azure/cliextensions/ssh/oras/provider.py", line 14, in <module>
    import jsonschema
  File "/root/.azure/cliextensions/ssh/jsonschema/__init__.py", line 13, in <module>
    from jsonschema._format import FormatChecker
  File "/root/.azure/cliextensions/ssh/jsonschema/_format.py", line 11, in <module>
    from jsonschema.exceptions import FormatError
  File "/root/.azure/cliextensions/ssh/jsonschema/exceptions.py", line 15, in <module>
    from referencing.exceptions import Unresolvable as _Unresolvable
  File "/root/.azure/cliextensions/ssh/referencing/__init__.py", line 5, in <module>
    from referencing._core import Anchor, Registry, Resource, Specification
  File "/root/.azure/cliextensions/ssh/referencing/_core.py", line 9, in <module>
    from rpds import HashTrieMap, HashTrieSet, List
  File "/root/.azure/cliextensions/ssh/rpds/__init__.py", line 1, in <module>
    from .rpds import *
ModuleNotFoundError: No module named 'rpds.rpds'

Issue script & Debug output

root@VD011855:/mnt/d/dev/ringfence# az ssh vm --hostname ${FQDN} --port 1022 --debug
cli.knack.cli: Command arguments: ['ssh', 'vm', '--hostname', 'SENSITIVEINFO.com', '--port', '1022', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f22f7384040>, <function OutputProducer.on_global_arguments at 0x7f22f7332200>, <function CLIQuery.on_global_arguments at 0x7f22f714bce0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'ssh': ['azext_ssh']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: Total (0)                 0.000         0         0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: ssh                       2.079         1         4  /root/.azure/cliextensions/ssh
cli.azure.cli.core: Total (1)                 2.079         1         4  
cli.azure.cli.core: Loaded 1 groups, 4 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : ssh vm
cli.azure.cli.core: Command table: ssh vm
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f22f678dda0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/root/.azure/commands/2024-09-19.14-33-33.ssh_vm.461.log'.
az_command_data_logger: command args: ssh vm --hostname {} --port {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f22f67c8540>]
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/__init__.py", line 526, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 321, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/az/lib/python3.11/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/root/.azure/cliextensions/ssh/azext_ssh/custom.py", line 20, in <module>
    from . import rdp_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/rdp_utils.py", line 19, in <module>
    from . import ssh_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/ssh_utils.py", line 20, in <module>
    from . import connectivity_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/connectivity_utils.py", line 10, in <module>
    import oras.client
  File "/root/.azure/cliextensions/ssh/oras/client.py", line 12, in <module>
    import oras.provider
  File "/root/.azure/cliextensions/ssh/oras/provider.py", line 14, in <module>
    import jsonschema
  File "/root/.azure/cliextensions/ssh/jsonschema/__init__.py", line 13, in <module>
    from jsonschema._format import FormatChecker
  File "/root/.azure/cliextensions/ssh/jsonschema/_format.py", line 11, in <module>
    from jsonschema.exceptions import FormatError
  File "/root/.azure/cliextensions/ssh/jsonschema/exceptions.py", line 15, in <module>
    from referencing.exceptions import Unresolvable as _Unresolvable
  File "/root/.azure/cliextensions/ssh/referencing/__init__.py", line 5, in <module>
    from referencing._core import Anchor, Registry, Resource, Specification
  File "/root/.azure/cliextensions/ssh/referencing/_core.py", line 9, in <module>
    from rpds import HashTrieMap, HashTrieSet, List
  File "/root/.azure/cliextensions/ssh/rpds/__init__.py", line 1, in <module>
    from .rpds import *
ModuleNotFoundError: No module named 'rpds.rpds'

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: No module named 'rpds.rpds'
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/__init__.py", line 526, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 321, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/az/lib/python3.11/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/root/.azure/cliextensions/ssh/azext_ssh/custom.py", line 20, in <module>
    from . import rdp_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/rdp_utils.py", line 19, in <module>
    from . import ssh_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/ssh_utils.py", line 20, in <module>
    from . import connectivity_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/connectivity_utils.py", line 10, in <module>
    import oras.client
  File "/root/.azure/cliextensions/ssh/oras/client.py", line 12, in <module>
    import oras.provider
  File "/root/.azure/cliextensions/ssh/oras/provider.py", line 14, in <module>
    import jsonschema
  File "/root/.azure/cliextensions/ssh/jsonschema/__init__.py", line 13, in <module>
    from jsonschema._format import FormatChecker
  File "/root/.azure/cliextensions/ssh/jsonschema/_format.py", line 11, in <module>
    from jsonschema.exceptions import FormatError
  File "/root/.azure/cliextensions/ssh/jsonschema/exceptions.py", line 15, in <module>
    from referencing.exceptions import Unresolvable as _Unresolvable
  File "/root/.azure/cliextensions/ssh/referencing/__init__.py", line 5, in <module>
    from referencing._core import Anchor, Registry, Resource, Specification
  File "/root/.azure/cliextensions/ssh/referencing/_core.py", line 9, in <module>
    from rpds import HashTrieMap, HashTrieSet, List
  File "/root/.azure/cliextensions/ssh/rpds/__init__.py", line 1, in <module>
    from .rpds import *
ModuleNotFoundError: No module named 'rpds.rpds'
az_command_data_logger: No module named 'rpds.rpds'
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/__init__.py", line 526, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 321, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/az/lib/python3.11/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/root/.azure/cliextensions/ssh/azext_ssh/custom.py", line 20, in <module>
    from . import rdp_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/rdp_utils.py", line 19, in <module>
    from . import ssh_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/ssh_utils.py", line 20, in <module>
    from . import connectivity_utils
  File "/root/.azure/cliextensions/ssh/azext_ssh/connectivity_utils.py", line 10, in <module>
    import oras.client
  File "/root/.azure/cliextensions/ssh/oras/client.py", line 12, in <module>
    import oras.provider
  File "/root/.azure/cliextensions/ssh/oras/provider.py", line 14, in <module>
    import jsonschema
  File "/root/.azure/cliextensions/ssh/jsonschema/__init__.py", line 13, in <module>
    from jsonschema._format import FormatChecker
  File "/root/.azure/cliextensions/ssh/jsonschema/_format.py", line 11, in <module>
    from jsonschema.exceptions import FormatError
  File "/root/.azure/cliextensions/ssh/jsonschema/exceptions.py", line 15, in <module>
    from referencing.exceptions import Unresolvable as _Unresolvable
  File "/root/.azure/cliextensions/ssh/referencing/__init__.py", line 5, in <module>
    from referencing._core import Anchor, Registry, Resource, Specification
  File "/root/.azure/cliextensions/ssh/referencing/_core.py", line 9, in <module>
    from rpds import HashTrieMap, HashTrieSet, List
  File "/root/.azure/cliextensions/ssh/rpds/__init__.py", line 1, in <module>
    from .rpds import *
ModuleNotFoundError: No module named 'rpds.rpds'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f22f678e020>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 3.750 seconds (init: 0.213, invoke: 3.537)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 7655 in cache file under /root/.azure/telemetry/20240919143334595
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /root/.azure /root/.azure/telemetry/20240919143334595"
telemetry.process: Return from creating process 466
telemetry.main: Finish creating telemetry upload process.

Expected behavior

az ssh config downloads a config file or az ssh vm connects to the vm

Environment Summary

azure-cli                         2.64.0

core                              2.64.0
telemetry                          1.1.0

Extensions:
containerapp                     1.0.0b2
managementpartner                  0.1.3
resource-graph                     2.1.0
ssh                                2.0.5

Dependencies:
msal                              1.30.0
azure-mgmt-resource               23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.11.8 (main, Aug 28 2024, 05:45:28) [GCC 9.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

this used to work fine with older version (i think around 2.58/2.59) but downgrading to these versions is now also broken...

yonzhan commented 1 month ago

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

Gutza commented 1 month ago

Same error under WSL2 (Ubuntu):

$ az upgrade
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
You already have the latest azure-cli version: 2.64.0
Upgrading extensions
Default enabled including preview versions for extension installation now. Disabled in future release. Use '--allow-preview-extensions true' to enable it specifically if needed. Use '--allow-preview-extensions false' to install stable version only.
Checking update for ssh
Latest version of 'ssh' is already installed.

Use --debug for more information
Upgrade finished.You can enable auto-upgrade with 'az config set auto-upgrade.enable=yes'. More details in https://docs.microsoft.com/cli/azure/update-azure-cli#automatic-update

$ az version
{
  "azure-cli": "2.64.0",
  "azure-cli-core": "2.64.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "ssh": "2.0.5"
  }
}

$ az ssh config --file ./sshconfig-az-main-WSL --resource-group (sanitized) --name (sanitized)
The command failed with an unexpected error. Here is the traceback:
No module named 'rpds.rpds'
Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/__init__.py", line 526, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 321, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/az/lib/python3.11/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/(sanitized)/.azure/cliextensions/ssh/azext_ssh/custom.py", line 20, in <module>
    from . import rdp_utils
  File "/home/(sanitized)/.azure/cliextensions/ssh/azext_ssh/rdp_utils.py", line 19, in <module>
    from . import ssh_utils
  File "/home/(sanitized)/.azure/cliextensions/ssh/azext_ssh/ssh_utils.py", line 20, in <module>
    from . import connectivity_utils
  File "/home/(sanitized)/.azure/cliextensions/ssh/azext_ssh/connectivity_utils.py", line 10, in <module>
    import oras.client
  File "/home/(sanitized)/.azure/cliextensions/ssh/oras/client.py", line 12, in <module>
    import oras.provider
  File "/home/(sanitized)/.azure/cliextensions/ssh/oras/provider.py", line 14, in <module>
    import jsonschema
  File "/home/(sanitized)/.azure/cliextensions/ssh/jsonschema/__init__.py", line 13, in <module>
    from jsonschema._format import FormatChecker
  File "/home/(sanitized)/.azure/cliextensions/ssh/jsonschema/_format.py", line 11, in <module>
    from jsonschema.exceptions import FormatError
  File "/home/(sanitized)/.azure/cliextensions/ssh/jsonschema/exceptions.py", line 15, in <module>
    from referencing.exceptions import Unresolvable as _Unresolvable
  File "/home/(sanitized)/.azure/cliextensions/ssh/referencing/__init__.py", line 5, in <module>
    from referencing._core import Anchor, Registry, Resource, Specification
  File "/home/(sanitized)/.azure/cliextensions/ssh/referencing/_core.py", line 9, in <module>
    from rpds import HashTrieMap, HashTrieSet, List
  File "/home/(sanitized)/.azure/cliextensions/ssh/rpds/__init__.py", line 1, in <module>
    from .rpds import *
ModuleNotFoundError: No module named 'rpds.rpds'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
Gutza commented 1 month ago

I made it work by purging everything and reinstalling everything from scratch; I'm not sure I needed to be this radical; if I had to do it again I would try things in order from the less dramatic to the more radical:

  1. attempt uninstalling and reinstalling just the ssh extension
    az extension remove -n ssh
    az ssh ... # The original command
  2. attempt uninstalling and reinstalling azure-cli
    sudo apt remove azure-cli -y
    curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
    az ssh ... # The original command
  3. purge everything and reinstall from scratch
    sudo apt remove azure-cli -y
    rm -rf ~/.azure
    sudo rm -rf /opt/az /usr/bin/az
    curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
    az login
    az ssh ... # The original command
lejulien-42 commented 1 month ago

I did had the same issue, only reinstalling the ssh extension made it work again.

poorleno1 commented 3 weeks ago

I have the same error on macos, I have those message run in debug mode when installing ssh extension:

cli.azure.cli.core.extension.operations: Linux distro check: Reading from: /etc/apt/sources.list.d/azure-cli.list cli.azure.cli.core.extension.operations: Linux distro check: An error occurred while checking linux distribution version source list consistency. cli.azure.cli.core.extension.operations: [Errno 2] No such file or directory: '/etc/apt/sources.list.d/azure-cli.list' cli.azure.cli.core.extension.operations: Executing pip with args: ['install', '--target', '/Users/jarekolechno/.azure/cliextensions/ssh', '/var/folders/yw/8cp8fq_d4mv1lmfr7lh_p68w0000gn/T/tmpy5eyvnxy/ssh-2.0.5-py3-none-any.whl'] cli.azure.cli.core.extension.operations: Running: ['/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/bin/python', '-m', 'pip', 'install', '--target', '/Users/jarekolechno/.azure/cliextensions/ssh', '/var/folders/yw/8cp8fq_d4mv1lmfr7lh_p68w0000gn/T/tmpy5eyvnxy/ssh-2.0.5-py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir'] cli.azure.cli.core.extension.operations: /opt/homebrew/Cellar/azure-cli/2.65.0/libexec/bin/python: No module named pip

cli.azure.cli.core.extension.operations: Command '['/opt/homebrew/Cellar/azure-cli/2.65.0/libexec/bin/python', '-m', 'pip', 'install', '--target', '/Users/jarekolechno/.azure/cliextensions/ssh', '/var/folders/yw/8cp8fq_d4mv1lmfr7lh_p68w0000gn/T/tmpy5eyvnxy/ssh-2.0.5-py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir']' returned non-zero exit status 1. cli.azure.cli.core.extension.operations: Pip failed so deleting anything we might have installed at

I would be great to get this resolved.

sadhasivam commented 2 weeks ago

uninstall and reinstall worked for me. (Mac Sonama) likely conflict with python 13 or something.

poorleno1 commented 2 weeks ago

thanks @sadhasivam . I had to uninstall all python versions I had and install azure-cli.

clowa commented 5 days ago

Reinstalling the extension via az extension remove -n ssh && az extension add -n ssh fixed it for me.

Azure CLI Version: 2.65.0