microsoft / vscode-dev-containers

NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
https://aka.ms/vscode-remote
MIT License
4.72k stars 1.4k forks source link

python:3.10-bullseye has Python 3.9 instead #1691

Closed BorjaEst closed 1 year ago

BorjaEst commented 1 year ago

Steps to Reproduce:

1 .devcontainer.json

{
    "name": "Python 3",
    "image": "mcr.microsoft.com/devcontainers/python:3.10-bullseye",
    "features": {
        "ghcr.io/devcontainers/features/node:1": {
            "version": "lts"
        },
        "ghcr.io/devcontainers/features/common-utils:1": {},
        "ghcr.io/devcontainers/features/git:1": {},
        "ghcr.io/devcontainers/features/nvidia-cuda:1": {},
        "ghcr.io/devcontainers/features/python:1": {},
        "ghcr.io/rocker-org/devcontainer-features/pandoc:1": {},
        "ghcr.io/devcontainers-contrib/features/pylint:1": {},
        "ghcr.io/devcontainers-contrib/features/tox:1": {}
    },

    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],

    // Use 'postCreateCommand' to run commands after the container is created.
    "postCreateCommand": "pip3 install --user -r requirements-test.txt",

    // Configure tool-specific properties.
    // "customizations": {},

    // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
    "remoteUser": "vscode"
}

2 Terminal

vscode ➜ /workspaces/genca (dev ✗) $ python
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.

See that Python 3.9 is installed instead of 3.10.

Chuxel commented 1 year ago

@BorjaEst You included the "ghcr.io/devcontainers/features/python:1": {} feature which will default to installing the OS version of python and including that in the path. If you only want the tools in the python feature, set version to none. "ghcr.io/devcontainers/features/python:1": { "version": "none" }

Also note that all of these tools are already in the image, so you can probably just remove that line.

BorjaEst commented 1 year ago

@Chuxel, that solved the issue, thanks!