pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.55k stars 3.04k forks source link

subprocess.CalledProcessError: Command '('uname', '-rs')' returned non-zero exit status 1. #11435

Closed verdverm closed 2 years ago

verdverm commented 2 years ago

Description

I'm trying to build a docker image in GitHub Actions with buildx, qemu, and arm64

I get the following error during pip install --upgrade pip pipenv

subprocess.CalledProcessError: Command '('uname', '-rs')' returned non-zero exit status 1.

The code is here: https://github.com/hofstadter-io/hof/tree/_dev/formatters/tools/black

The failing code is the commented out section of the Dockerfile. I've tried various approaches and all fail with the same error.

Expected behavior

The docker image builds on arm64 like it does for amd64

pip version

22.2.1

Python version

3.10.6

OS

unbuntu-20.04

How to Reproduce

  1. git clone https://github.com/hofstadter-io/hof
  2. cd hof/formatters
  3. make black.march

might need to do some steps to setup buildx

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name cibuilder --driver docker-container --use
docker buildx ls
docker buildx inspect --bootstrap

The readme under the formatters directory has several links at the bottom


It might be enough to run pip install -r requirements.txt from the formatters/tools/black directory. I do not have an arm64 or M1 machine to test this on

Output

No response

Code of Conduct

uranusjr commented 2 years ago

Would it be possible for you to create more stripped-down steps to reproduce this? (e.g. use only one Dockerfile and a build command) This orignates from a vendor package (distro) and we need a simpler way to reproduce this for upstream to debug.

verdverm commented 2 years ago

I could, but I may have also figured out the underlying problem.

It seems to be subtle differences in PATH and where binaries are installed between amd64 and arm64

I've been getting similar errors in the cross product of { alpine, debian } X { python, node, ruby } so I am not convinced this is specific to python or pip yet. I've worked through the node, ruby issues, but am still getting the same issue with python.

Note, this works with regular docker and buildx for amd64, it only occurs on arm64

uranusjr commented 2 years ago

Yeah, cross-building does tend to induce some very subtle environment issues due to emulation, I’ve dealt with several annoying issues myself.

verdverm commented 2 years ago

All green https://github.com/hofstadter-io/hof/runs/8201219165