Comment 5 for bug 1768233

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

This seems to be due to the mix of stage-packages and python-packages, where pkg_resources from the staged python is loaded and the part's pip wanting to use pkg_resources, but instead of loading its vendored version it ends up using the already loaded one from stage, here's a workaround:

(snapcraft) ubuntu@snapcraft-xenial-dev:~/t$ cat snap/snapcraft.yaml
name: python-chained-parts
version: "0"
summary: test the python plugin
description: |
  This is a snap with a chain of python related parts
confinement: strict
grade: devel

parts:
  part1:
    plugin: python
    stage-packages:
      - python3-requests-unixsocket
  part2:
    plugin: nil
    stage-packages:
      - python3-yaml
    after:
      - part1
  part3:
    plugin: python
    python-packages:
      - bitstring
    stage-packages:
      - python3-pip
      - python3-wheel
      - python3-setuptools
    after:
      - part2

Or alternatively
(snapcraft) ubuntu@snapcraft-xenial-dev:~/t$ cat snap/snapcraft.yaml
name: python-chained-parts
version: "0"
summary: test the python plugin
description: |
  This is a snap with a chain of python related parts
confinement: strict
grade: devel

parts:
  part1:
    plugin: python
    stage-packages:
      - python3-requests-unixsocket
  part2:
    plugin: nil
    stage-packages:
      - python3-yaml
      - python3-pip
      - python3-wheel
      - python3-setuptools
    after:
      - part1
  part3:
    plugin: python
    python-packages:
      - bitstring
    after:
      - part2