[GH-ISSUE #180] Installing into vscode dev container - fail #98

Closed
opened 2026-02-27 15:46:27 +03:00 by kerem · 4 comments
Owner

Originally created by @Daxcor69 on GitHub (Oct 17, 2024).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/180

Hello, I am running a vscode dev container. I have installed python via the ansible apt package. Here is my Dockerfile layout

FROM mcr.microsoft.com/devcontainers/base:noble

RUN apt update && \
    apt upgrade -y && \
    apt install -y software-properties-common && \
    apt-add-repository --yes --update ppa:ansible/ansible && \
    apt install -y ansible && \
    apt install iputils-ping -y && \
    apt install python3-venv python3-pip -y

When I enter the container shell, and issue ` pip install proxmoxer' I get the following error.

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

I am stuck. I don't know what to do. I have confirmed that pip, pip3 and pip3.12 are installed in the container. Not sure if will help but here is the devcontainer.json file

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
	"name": "Ubuntu",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	//"image": "mcr.microsoft.com/devcontainers/base:noble",
	"build": {
		"dockerfile": "Dockerfile"	
	},
	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			// Set *default* container specific settings.json values on container create.
			"settings": {},
			"extensions": [ "wholroyd.jinja", "redhat.ansible","esbenp.prettier-vscode","streetsidesoftware.code-spell-checker","Tailscale.vscode-tailscale"]
		}
	}   
}

Please any ideas or help would be greatly appreciated.
Thanks
Brad

Originally created by @Daxcor69 on GitHub (Oct 17, 2024). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/180 Hello, I am running a vscode dev container. I have installed python via the ansible apt package. Here is my Dockerfile layout ``` FROM mcr.microsoft.com/devcontainers/base:noble RUN apt update && \ apt upgrade -y && \ apt install -y software-properties-common && \ apt-add-repository --yes --update ppa:ansible/ansible && \ apt install -y ansible && \ apt install iputils-ping -y && \ apt install python3-venv python3-pip -y ``` When I enter the container shell, and issue ` pip install proxmoxer' I get the following error. ``` error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.12/README.venv for more information. note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification. ``` I am stuck. I don't know what to do. I have confirmed that pip, pip3 and pip3.12 are installed in the container. Not sure if will help but here is the devcontainer.json file ``` // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu { "name": "Ubuntu", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile //"image": "mcr.microsoft.com/devcontainers/base:noble", "build": { "dockerfile": "Dockerfile" }, // Configure tool-specific properties. "customizations": { // Configure properties specific to VS Code. "vscode": { // Set *default* container specific settings.json values on container create. "settings": {}, "extensions": [ "wholroyd.jinja", "redhat.ansible","esbenp.prettier-vscode","streetsidesoftware.code-spell-checker","Tailscale.vscode-tailscale"] } } } ``` Please any ideas or help would be greatly appreciated. Thanks Brad
kerem closed this issue 2026-02-27 15:46:27 +03:00
Author
Owner

@morph027 commented on GitHub (Oct 17, 2024):

It's all there:

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.

This is the new, default pip behaviour. It encourages you to create a virtual environment to not mess up system packages.

<!-- gh-comment-id:2418890946 --> @morph027 commented on GitHub (Oct 17, 2024): It's all there: > note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing `--break-system-packages`. This is the new, default pip behaviour. It encourages you to create a virtual environment to not mess up system packages.
Author
Owner

@morph027 commented on GitHub (Oct 17, 2024):

Hint: proxmoxer does not specify any dependencies in it's setup script, so no other system packages will change by just installing it with the flag.

If you like to test another solution, i've created a Debian package for testing: https://download.morph027.de/python3-proxmoxer_2.1.0+1_all.deb

Edit: also created a follow up in https://github.com/proxmoxer/proxmoxer/issues/181

<!-- gh-comment-id:2418912138 --> @morph027 commented on GitHub (Oct 17, 2024): Hint: proxmoxer does not specify any dependencies in it's setup script, so no other system packages will change by just installing it with the flag. If you like to test another solution, i've created a Debian package for testing: https://download.morph027.de/python3-proxmoxer_2.1.0+1_all.deb Edit: also created a follow up in https://github.com/proxmoxer/proxmoxer/issues/181
Author
Owner

@Daxcor69 commented on GitHub (Oct 17, 2024):

Thank you for the help. I used the flag to install proxmoxer and requests. When I do pip list, is see both packages listed. When I go to run the ansible playbook referencing community.general.proxmox_kvm I get the error

"msg": "Failed to import the required Python library (proxmoxer) on pve0's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"

When I look at ansible docs, what I see is

The below requirements are needed on the host that executes this module.
proxmoxer
requests

Is the host in question the promox host or the host running the ansible playbook. From the error it is saying pve0 which is the proxmox host.

Any help would be appreciated.
Brad

<!-- gh-comment-id:2419643672 --> @Daxcor69 commented on GitHub (Oct 17, 2024): Thank you for the help. I used the flag to install proxmoxer and requests. When I do pip list, is see both packages listed. When I go to run the ansible playbook referencing community.general.proxmox_kvm I get the error ``` "msg": "Failed to import the required Python library (proxmoxer) on pve0's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter" ``` When I look at ansible docs, what I see is The below requirements are needed on the host that executes this module. proxmoxer requests Is the host in question the promox host or the host running the ansible playbook. From the error it is saying pve0 which is the proxmox host. Any help would be appreciated. Brad
Author
Owner

@Daxcor69 commented on GitHub (Oct 17, 2024):

I figured it out, I had to install this on the proxmox server itself. apt install python3-proxmoxer

<!-- gh-comment-id:2420584400 --> @Daxcor69 commented on GitHub (Oct 17, 2024): I figured it out, I had to install this on the proxmox server itself. apt install python3-proxmoxer
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#98
No description provided.