Azure / Azure/azure-linux-extensions

Python 3.12 support missing

Open
#1,908 3 comments 6 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
333
Forks
278
Avg merge
2d 9h
Merged PRs (30d)
4

Description

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](https://docs.python.org/3.12/whatsnew/3.12.html#imp)]

I am facing same issue with other extension **LinuxDiagnostic**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.