Azure / azure-linux-extensions

Linux Virtual Machine Extensions for Azure
Apache License 2.0
301 stars 251 forks source link

Python 3.12 support missing #1908

Open xordux opened 3 months ago

xordux commented 3 months ago

When I try to install AzureMonitorAgent, I get following error:

PS C:\Users\rohitrawat> az vm extension set --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --ids "/subscriptions/80248fc1-bf75-48f2-b344-23988088df3f/resourceGroups/lisa-On-Demand-test-20240402-110548-746-e0/providers/Microsoft.Compute/virtualMachines/lisa-On-Demand-test-20240402-110548-746-e0-n0" --enable-auto-upgrade true
(VMExtensionHandlerNonTransientError) The handler for VM extension type 'Microsoft.Azure.Monitor.AzureMonitorLinuxAgent' has reported terminal failure for VM extension 'AzureMonitorLinuxAgent' with error message: '[ExtensionOperationError] Non-zero exit code: 51, /var/lib/waagent/Microsoft.Azure.Monitor.AzureMonitorLinuxAgent-1.30.3/./shim.sh -install
[stdout]
Python 3.12.0
Importing utils failed with error: No module named 'imp'
Unable to initialize waagent log because of exception name 'waagent' is not defined
Info: Azure Monitoring Agent for Linux started to handle.
Error: Unsupported operating system: azurelinux 3.0
Error: Unsupported operating system: azurelinux 3.0

[stderr]
/var/lib/waagent/Microsoft.Azure.Monitor.AzureMonitorLinuxAgent-1.30.3/./agent.py:38: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
  import crypt
'.

'Install handler failed for the extension. More information on troubleshooting is available at https://aka.ms/vmextensionlinuxtroubleshoot'
Code: VMExtensionHandlerNonTransientError
Message: The handler for VM extension type 'Microsoft.Azure.Monitor.AzureMonitorLinuxAgent' has reported terminal failure for VM extension 'AzureMonitorLinuxAgent' with error message: '[ExtensionOperationError] Non-zero exit code: 51, /var/lib/waagent/Microsoft.Azure.Monitor.AzureMonitorLinuxAgent-1.30.3/./shim.sh -install
[stdout]
Python 3.12.0
Importing utils failed with error: No module named 'imp'
Unable to initialize waagent log because of exception name 'waagent' is not defined
Info: Azure Monitoring Agent for Linux started to handle.
Error: Unsupported operating system: azurelinux 3.0
Error: Unsupported operating system: azurelinux 3.0

[stderr]
/var/lib/waagent/Microsoft.Azure.Monitor.AzureMonitorLinuxAgent-1.30.3/./agent.py:38: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
  import crypt
'.

'Install handler failed for the extension. More information on troubleshooting is available at https://aka.ms/vmextensionlinuxtroubleshoot'

The OS has Python 3.12 and this seems to be issue with imp module being removed in python 3.12 [link]

I am facing same issue with other extension LinuxDiagnostic

aadhar-agarwal commented 2 months ago

Hi @NarineM, I see you made https://github.com/Azure/azure-linux-extensions/pull/1904. Could you please help take a look at the PR again? :)

imp has been deprecated in Python 3.12