Python 3.11 devcontainer fails to build with "error: invalid command 'bdist_wheel'"
The python 3.11 devcontainer fails to build.
I've included the relevant lines from the devcontainer.json and log file. When I set the python version to 3.11 and image to python:1-3.11-bullseye the build fails with an error message "error: invalid command 'bdist_wheel'" . When I update the devcontainer to 3.12 using either the 3.11 or 3.12 images, the build is successful. The specific 3.11 version being built is 3.11.8.
devcontainer.json (relevant lines)
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
// "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/python:1": {
// "version": "3.12"
"version": "3.11"
// "installTools": true,
// "toolsToInstall": "pytest,pylint"
}
},
devcontainer log file: (shortend, but I can provide the complete log if necessary) ..... Requirement already satisfied: pip in /usr/local/python/3.11.8/lib/python3.11/site-packages (24.0) flake8 already installed. Skipping. autopep8 already installed. Skipping. black already installed. Skipping. yapf already installed. Skipping. mypy already installed. Skipping. pydocstyle already installed. Skipping. pycodestyle already installed. Skipping. bandit already installed. Skipping. pipenv already installed. Skipping. virtualenv already installed. Skipping. pytest already installed. Skipping. pylint already installed. Skipping. Collecting setuptools==65.5.1 Downloading setuptools-65.5.1.tar.gz (2.6 MB) ââââââââââââââââââââââââââââââââââââââââ 2.6/2.6 MB 11.7 MB/s eta 0:00:00 Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Installing backend dependencies: started Installing backend dependencies: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Saved ./setuptools-65.5.1.tar.gz Successfully downloaded setuptools usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help
error: invalid command 'bdist_wheel' ERROR: Feature "Python" (ghcr.io/devcontainers/features/python) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/python for help troubleshooting this error.
I had the same issue.
Based on the observation that setting "skipVulnerabilityPatching": true avoids the error, it seems likely that this change https://github.com/devcontainers/features/pull/866 may have introduced this error.
The config below does not encounter "error: invalid command 'bdist_wheel'":
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "3.11",
"skipVulnerabilityPatching": true
},
I also just worked through this issue and found that pinning to features/python:1.3 resolved it. I encountered the "error: invalid command 'bdist_wheel'" error while using the following devcontainer.json feature block:
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "3.11.3"
},
And I resolved the issue by pinning to 1.3:
"ghcr.io/devcontainers/features/python:1.3": {
"installTools": true,
"version": "3.11.3"
},
Also, the 1.4.x releases of features/python are not tagged in Github so it is difficult to quickly determine the earliest release where the bug is present. It would be helpful if https://github.com/devcontainers/features/tags could contain tags for feature_python_1.4.0, 1.4.1, and 1.4.2, as it does for the 1.3.x versions.