Skip to content

az aks agent python package dependencies #8984

@mainred

Description

@mainred

Describe the bug

aks wants to leverage holmesgpt to provide AI-powered troubleshooting tool, but when import holmes as a package, we hit dependency issue so far as such:

  File "/home/azureuser/.azure/cliextensions/aks-preview/gotrue/_async/gotrue_client.py", line 11, in <module>
    from jwt import get_algorithm_by_name
ImportError: cannot import name 'get_algorithm_by_name' from 'jwt' (/opt/az/lib/python3.12/site-packages/jwt/__init__.py)
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/utils/cache.py", line 5, in <module>
    import bz2
  File "/opt/az/lib/python3.12/bz2.py", line 17, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

Related command

a new command will be created to az aks agent to call holmesgpt as a library

Errors

The command failed with an unexpected error. Here is the traceback:
cannot import name 'get_algorithm_by_name' from 'jwt' (/opt/az/lib/python3.12/site-packages/jwt/__init__.py)
Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 552, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 321, in load_arguments
    super().load_arguments()
  File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 124, in arguments_loader
    op = self.get_op_handler(self.op_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/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.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/azureuser/.azure/cliextensions/aks-preview/azext_aks_preview/custom.py", line 4729, in <module>
    from holmes.config import Config
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/config.py", line 17, in <module>
    from holmes.core.supabase_dal import SupabaseDal
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/core/supabase_dal.py", line 17, in <module>
    from supabase import create_client
  File "/home/azureuser/.azure/cliextensions/aks-preview/supabase/__init__.py", line 1, in <module>
    from gotrue.errors import (
  File "/home/azureuser/.azure/cliextensions/aks-preview/gotrue/__init__.py", line 4, in <module>
    from ._async.gotrue_client import AsyncGoTrueClient  # type: ignore # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/.azure/cliextensions/aks-preview/gotrue/_async/gotrue_client.py", line 11, in <module>
    from jwt import get_algorithm_by_name
ImportError: cannot import name 'get_algorithm_by_name' from 'jwt' (/opt/az/lib/python3.12/site-packages/jwt/__init__.py)
The command failed with an unexpected error. Here is the traceback:
No module named '_bz2'
Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 552, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 321, in load_arguments
    super().load_arguments()
  File "/opt/az/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 124, in arguments_loader
    op = self.get_op_handler(self.op_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/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.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/azureuser/.azure/cliextensions/aks-preview/azext_aks_preview/custom.py", line 4729, in <module>
    from holmes.config import Config
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/config.py", line 18, in <module>
    from holmes.core.tool_calling_llm import IssueInvestigator, ToolCallingLLM
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/core/tool_calling_llm.py", line 33, in <module>
    from holmes.core.safeguards import prevent_overly_repeated_tool_call
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/core/safeguards.py", line 7, in <module>
    from holmes.plugins.toolsets.logging_utils.logging_api import POD_LOGGING_TOOL_NAME
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/plugins/toolsets/__init__.py", line 38, in <module>
    from holmes.plugins.toolsets.prometheus.prometheus import PrometheusToolset
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/plugins/toolsets/prometheus/prometheus.py", line 31, in <module>
    from holmes.utils.cache import TTLCache
  File "/home/azureuser/.azure/cliextensions/aks-preview/holmes/utils/cache.py", line 5, in <module>
    import bz2
  File "/opt/az/lib/python3.12/bz2.py", line 17, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

Issue script & Debug output

check the above error details

Expected behavior

az aks agent should be able to provide interactive experience without package dependency error

Environment Summary

{
"azure-cli": "2.72.0",
"azure-cli-core": "2.72.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"amg": "2.6.1",
"interactive": "1.0.0b1"
}
}

Additional context

No response

Metadata

Metadata

Assignees

Labels

AKSAuto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions