Error building snaps with core18 base and python3

Hello,

I am trying to use latest snapcraft (v3.5) to build a python3 snap with base set to core18.Building with multipass is failing for me (refer Unable to use `build-environment`) Hence I am using export SNAPCRAFT_BUILD_ENVIRONMENT=host to build directly on the host.

The build fails during stage of the python part with the error Failed to fetch stage packages: Error downloading packages for part 'my-python-part': The package 'python3-distutils' was not found...

Has anyone come across this issue before and what is the solution.

My host is Ubuntu 16.04.6 LTS
snapcraft.yaml snippet

name: mysnap
base: core18
environment:
  LANG: C.UTF-8
  LC_ALL: C.UTF-8
parts:
  my-python-part:
    build-environment:
      - PIP_NO_BINARY: numpy,pandas
    plugin: python
    source: mypackage
    requirements: [requirements.txt]
    build-packages:
      - libxslt1-dev
      - libxml2-dev
    stage:
      - -tests

I believe this could be because of this line https://github.com/snapcore/snapcraft/blob/3f7d63cdf08070dc714e246a1c8424613f6b80db/snapcraft/plugins/python.py#L154 . On Ubuntu Xenial (16.04) should it be python3-distutils-extra ?

I’m only an occasional snap user, but if you want to build for ubuntu 18.04, and you want to use resources on the build host, you probably want to be running on an 18.04 build host.
Multipass is supposed to do that for you, but if that’s broken, you could manually spin up an 18.04 container with lxd or docker, and work in there…

1 Like