melange icon indicating copy to clipboard operation
melange copied to clipboard

Build with runtime python but pip could not find pip

Open imaffe opened this issue 2 years ago • 1 comments

I'm trying to build an apk with a client tool (pulsar-client), however, I would receive the following error when I run the code with

docker run --privileged --rm -v "${PWD}":/work \
  cgr.dev/chainguard/melange build python-melange.yaml \
  --arch x86,amd64,aarch64,armv7 \
  --signing-key melange.rsa

Exception : importlib.metadata.PackageNotFoundError: No package metadata was found for pip

The file is:

package:
  name: pulsar-python-client
  version: 0.1.0
  description: An custom apk packaing including pulsar python client
  target-architecture:
    - all
  copyright:
    - license: Apache-2.0
      paths:
        - "*"
  dependencies:
    runtime:
      - python3

environment:
  contents:
    repositories:
      - https://dl-cdn.alpinelinux.org/alpine/edge/main
      - https://dl-cdn.alpinelinux.org/alpine/edge/community
    packages:
      - alpine-baselayout-data
      - ca-certificates-bundle
      - busybox
      - gcc
      - musl-dev
      - python3
      - python3-dev
      - py3-pip
      - py3-virtualenv

pipeline:
  - name: install python client
    runs: |
      set -x
      pip install pulsar-client==2.10.2
      pip install pulsar-client[avro]=='2.10.2'
      pip install pulsar-client[functions]=='2.10.2'
      pip install pulsar-client[all]=='2.10.2'

I basically copied the code from https://github.com/chainguard-dev/hello-melange-apko/blob/main/py/melange.yaml, but it's not working.

Can we have an example how to install python?

imaffe avatar Nov 24 '22 05:11 imaffe

maybe try python3 -m pip --version. it seems to be working for me.

tuananh avatar Nov 26 '22 04:11 tuananh

This was most likely due to python migration in Alpine. None the less, this is not an issue specific to Melange and should be directed to Alpine.

kaniini avatar Mar 29 '23 18:03 kaniini