indygreg / indygreg/PyOxidizer

Building in Alpine / with Musl fails on pip download/install

Open
#504 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

Hi,

First of all - thanks for this awesome project!

I'm trying to do a pyoxidizer build with an Alpine container image ([based on this Dockerfile](https://github.com/jacobsvante/pyoxidizer-docker/blob/main/Dockerfile) with RUST_IMAGE=rust:1.58.1-alpine3.15). But as you can see I get the following error:

```
❯ rustc --version
rustc 1.58.1 (db9d1b20b 2022-01-20)
❯ pyoxidizer --version
PyOxidizer 0.18.0
commit: 0e47cdb07bd8fd0913925f08b03c393d86871a1d
source: https://github.com/indygreg/PyOxidizer.git
pyembed crate location: version = "0.18.0"
❯ pyoxidizer init-config-file --system-rust .
❯ sed -i.bkp 's/#exe.add_python_resources(exe.pip_download/exe.add_python_resources(exe.pip_download/g' ./pyoxidizer.bzl
❯ echo "FROM jacobsvante/pyoxidizer:1.58.1-alpine3.15@sha256:f72fb578d771b987a6444706ecf3b67341685353c8ef2b29da95c4e60662598d as builder
WORKDIR /build
RUN apk add --no-cache python3 py3-pip
COPY . .
RUN pyoxidizer build --system-rust --release" > Dockerfile
❯ docker build --progress=plain --no-cache -t pyoxidizer-musl-build-test:latest .
[...]
#9 [5/5] RUN pyoxidizer build --system-rust --release
#9 sha256:2dab5cd39b64ad4dccf2a7260831d94dbc9b360dd41814f159af7997de0c646e
#9 0.277 resolving 1 targets
#9 0.277 resolving target install
#9 0.277 resolving target exe
#9 0.277 resolving Python distribution https://github.com/indygreg/python-build-standalone/releases/download/20211017/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211017T1616.tar.zst (sha256=1c490d71269eaeebe4de109d9bd1d22281cc028f2161bfe467f6df31de326e3a)
#9 0.278 downloading https://github.com/indygreg/python-build-standalone/releases/download/20211017/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211017T1616.tar.zst
#9 2.128 Python distribution available at /root/.cache/pyoxidizer/python_distributions/cpython-3.9.7-x86_64-unknown-linux-gnu-pgo-20211017T1616.tar.zst
#9 2.128 reading data from Python distribution...
#9 2.931 pip downloading to /tmp/pyoxidizer-pip-downloadq6FKEv
#9 2.931 running python ["-m", "pip", "--disable-pip-version-check", "download", "--dest", "/tmp/pyoxidizer-pip-downloadq6FKEv", "--only-binary=:all:", "--platform=manylinux2014_x86_64", "--python-version=3.9.7", "--implementation=cp", "pyflakes==2.2.0"]
#9 2.934 error[PYOXIDIZER_PYTHON_EXECUTABLE]: calling pip download
#9 2.934
#9 2.934 Caused by:
#9 2.934 No such file or directory (os error 2)
#9 2.934 --> ./pyoxidizer.bzl:241:30
#9 2.934 |
#9 2.934 241 | exe.add_python_resources(exe.pip_download(["pyflakes==2.2.0"]))
#9 2.934 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PythonExecutable.pip_download()
#9 2.934
#9 2.934
#9 2.934 error: calling pip download
#9 2.934
#9 2.934 Caused by:
#9 2.934 No such file or directory (os error 2)
#9 ERROR: executor failed running [/bin/sh -c pyoxidizer build --system-rust --release]: exit code: 1
------
> [5/5] RUN pyoxidizer build --system-rust --release:
------
executor failed running [/bin/sh -c pyoxidizer build --system-rust --release]: exit code: 1
```

The same happens if I do `exe.pip_install` instead of `exe.pip_download`.

What's going on here? Both `pip` and `python` are available in path.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Alpine/musl build from the linked Dockerfile and inspect the pip_download call at pyoxidizer.bzl:241, along with the pyoxidizer build --system-rust --release entry point. Trace why the embedded Python executable cannot run pip in this environment; done means pip_download and pip_install work during the reported build or the failure is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python, rust
Domain
build-system, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.