Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue to install add-on #44

Open
JeromeH27 opened this issue Dec 21, 2024 · 12 comments · Fixed by #46
Open

Issue to install add-on #44

JeromeH27 opened this issue Dec 21, 2024 · 12 comments · Fixed by #46
Assignees
Labels
bug Something isn't working

Comments

@JeromeH27
Copy link

Hello,

I got this error during the installation:
Failed to install add-on
The command '/bin/ash -o pipefail -c apk --update --no-cache add python3 py3-pip && pip install --no-cache-dir requests flask' returned a non-zero code: 2

my current configuration is:
Core 2024.12.5
Supervisor 2024.12.0
Operating System 14.1
Frontend 20241127.8

Do you know how I can fix it?

Regards,
JeromeH27

@ChrisRomp ChrisRomp self-assigned this Dec 22, 2024
@ChrisRomp
Copy link
Owner

Hi @JeromeH27 - sorry for the delayed response. Holidays. 😄

Can you share your platform? Are you running Home Assistant on a PC, NAS, Pi, etc.?

@JeromeH27
Copy link
Author

Hi ChrisRomp,

no issue :o)

Home Assistant is running on a laptop, here some informations:
OS Version: Home Assistant OS 14.1
Home Assistant Core: 2025.1.0

feel free if you need more details.

@ChrisRomp
Copy link
Owner

What CPU? I'll see if I can reproduce your issue.

@ChrisRomp
Copy link
Owner

And what OS is your host machine?

@JeromeH27
Copy link
Author

OS is Home Assistant OS 14.1, it seems to be based on Alpine Linux 3.21

CPU is a intel x86-64

@ChrisRomp
Copy link
Owner

Alright, I've managed to repro this. The important bit was above the error code in the log:

docker build -t ecowitt-temp --build-arg BUILD_FROM=alpine:3.21 .
Sending build context to Docker daemon  136.7kB
Step 1/9 : ARG BUILD_FROM
Step 2/9 : FROM ${BUILD_FROM}
3.21: Pulling from library/alpine
245043d9199c: Pull complete
Digest: sha256:b97e2a89d0b9e4011bb88c02ddf01c544b8c781acf1f4d559e7c8f12f1047ac3
Status: Downloaded newer image for alpine:3.21
 ---> 8a87ea05ce92
Step 3/9 : RUN apk --update --no-cache add python3 py3-pip   && pip install --no-cache-dir requests flask
 ---> Running in 4e3955bdf828
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
(1/25) Installing libbz2 (1.0.8-r6)
(2/25) Installing libexpat (2.6.4-r0)
(3/25) Installing libffi (3.4.6-r0)
(4/25) Installing gdbm (1.24-r0)
(5/25) Installing xz-libs (5.6.3-r0)
(6/25) Installing libgcc (14.2.0-r4)
(7/25) Installing libstdc++ (14.2.0-r4)
(8/25) Installing mpdecimal (4.0.0-r0)
(9/25) Installing ncurses-terminfo-base (6.5_p20241006-r3)
(10/25) Installing libncursesw (6.5_p20241006-r3)
(11/25) Installing libpanelw (6.5_p20241006-r3)
(12/25) Installing readline (8.2.13-r0)
(13/25) Installing sqlite-libs (3.47.1-r0)
(14/25) Installing python3 (3.12.8-r1)
(15/25) Installing python3-pycache-pyc0 (3.12.8-r1)
(16/25) Installing pyc (3.12.8-r1)
(17/25) Installing py3-setuptools-pyc (70.3.0-r0)
(18/25) Installing py3-pip-pyc (24.3.1-r0)
(19/25) Installing py3-parsing (3.1.4-r0)
(20/25) Installing py3-parsing-pyc (3.1.4-r0)
(21/25) Installing py3-packaging-pyc (24.2-r0)
(22/25) Installing python3-pyc (3.12.8-r1)
(23/25) Installing py3-packaging (24.2-r0)
(24/25) Installing py3-setuptools (70.3.0-r0)
(25/25) Installing py3-pip (24.3.1-r0)
Executing busybox-1.37.0-r9.trigger
OK: 64 MiB in 40 packages
error: externally-managed-environment

× This environment is externally managed
╰─>
    The system-wide python installation should be maintained using the system
    package manager (apk) only.

    If the package in question is not packaged already (and hence installable via
    "apk add py3-somepackage"), please consider installing it inside a virtual
    environment, e.g.:

    python3 -m venv /path/to/venv
    . /path/to/venv/bin/activate
    pip install mypackage

    To exit the virtual environment, run:

    deactivate

    The virtual environment is not deleted, and can be re-entered by re-sourcing
    the activate file.

    To automatically manage virtual environments, consider using pipx (from the
    pipx package).

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.
The command '/bin/sh -c apk --update --no-cache add python3 py3-pip   && pip install --no-cache-dir requests flask' returned a non-zero code: 1

It looks like this error: externally-managed-environment thing coming from PEP-0668 is relatively new (or newly enforced).

It looks like we can clobber this with the --break-system-packages arg, which I'm ok doing in a container since that (should) control the blast radius sufficiently.

I'll do some tests and push an update.

@ChrisRomp
Copy link
Owner

@JeromeH27 Pull the updated version v1.1.0 in your HA and try the installation again.

@JeromeH27
Copy link
Author

thank to have tried to fix it.

I just do a try, I got a similar error:
The command '/bin/ash -o pipefail -c apk --update --no-cache add python3 py3-pip' returned a non-zero code: 2

@ChrisRomp
Copy link
Owner

I'm gonna need more of the log if you can get it (check supervisor logs), and make sure you're pulling/building v1.1.0.

@ChrisRomp ChrisRomp reopened this Jan 8, 2025
@ChrisRomp
Copy link
Owner

In fact I can tell from that command that it's not the updated one. It's missing the new args.

@ChrisRomp
Copy link
Owner

Oh wait that's failing on the apk command not the pip command. Ok... try and get me more logs and that'll help. Otherwise I have no idea.

@JeromeH27
Copy link
Author

JeromeH27 commented Jan 9, 2025

I confirm the try is with version 1.1.0.

I just redo a try, here the logs from supervisor:

2025-01-09 09:04:45.643 INFO (MainThread) [supervisor.addons.addon] No 1d2e7f3c_ecowitt-proxy addon Docker image 1d2e7f3c/amd64-addon-ecowitt-proxy found
2025-01-09 09:04:45.645 INFO (MainThread) [supervisor.docker.addon] Starting build for 1d2e7f3c/amd64-addon-ecowitt-proxy:1.1.0
2025-01-09 09:04:56.603 ERROR (MainThread) [supervisor.docker.addon] Can't build 1d2e7f3c/amd64-addon-ecowitt-proxy:1.1.0: The command '/bin/ash -o pipefail -c apk --update --no-cache add python3 py3-pip' returned a non-zero code: 2
2025-01-09 09:04:56.603 ERROR (MainThread) [supervisor.docker.addon] Build log:
Step 1/15 : ARG BUILD_FROM
Step 2/15 : FROM ${BUILD_FROM}
---> cd7e6da44582
Step 3/15 : RUN apk --update --no-cache add python3 py3-pip
---> Running in a5ff046b9209
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.21/main: temporary error (try again later)
WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.21/community: temporary error (try again later)
ERROR: unable to select packages:
py3-pip (no such package):
required by: world[py3-pip]
python3 (no such package):
required by: world[python3]
---> Removed intermediate container a5ff046b9209
2025-01-09 09:04:56.621 INFO (MainThread) [supervisor.docker.addon] Starting build for 1d2e7f3c/amd64-addon-ecowitt-proxy:1.1.0
2025-01-09 09:05:07.545 ERROR (MainThread) [supervisor.docker.addon] Can't build 1d2e7f3c/amd64-addon-ecowitt-proxy:1.1.0: The command '/bin/ash -o pipefail -c apk --update --no-cache add python3 py3-pip' returned a non-zero code: 2
2025-01-09 09:05:07.545 ERROR (MainThread) [supervisor.docker.addon] Build log:
Step 1/15 : ARG BUILD_FROM
Step 2/15 : FROM ${BUILD_FROM}
---> cd7e6da44582
Step 3/15 : RUN apk --update --no-cache add python3 py3-pip
---> Running in fe274f1b3cbd
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
WARNING:
fetching https://dl-cdn.alpinelinux.org/alpine/v3.21/main: temporary error (try again later)
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.21/community: temporary error (try again later)
ERROR: unable to select packages:
py3-pip (no such package):
required by: world[py3-pip]
python3 (no such package):
required by: world[python3]
---> Removed intermediate container fe274f1b3cbd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants