Closed
Description
How to reproduce?
Setup in a fresh VSCode environment a new DevContainer setup ... e.g., using the wizzard. Select Python on Debian Bookworm, add azure-cli feature. This results in the following devcontainer setup:
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm",
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {}
}
}
Re-opening VSCode in the container works fine, installation of the feature succeeds. However, the azure-cli
does not work at the command line due to the missing distutils
package, which is removed in Python 3.12:
vscode ➜ /workspaces/test $ az
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/local/pipx/venvs/azure-cli/lib/python3.12/site-packages/azure/cli/__main__.py", line 39, in <module>
az_cli = get_default_cli()
^^^^^^^^^^^^^^^^^
File "/usr/local/pipx/venvs/azure-cli/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 917, in get_default_cli
from azure.cli.core.azlogging import AzCliLogging
File "/usr/local/pipx/venvs/azure-cli/lib/python3.12/site-packages/azure/cli/core/azlogging.py", line 30, in <module>
from azure.cli.core.commands.events import EVENT_INVOKER_PRE_CMD_TBL_TRUNCATE
File "/usr/local/pipx/venvs/azure-cli/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 25, in <module>
from azure.cli.core.extension import get_extension
File "/usr/local/pipx/venvs/azure-cli/lib/python3.12/site-packages/azure/cli/core/extension/__init__.py", line 11, in <module>
from distutils.sysconfig import get_python_lib # pylint: disable=deprecated-module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'