snapcraft
snapcraft copied to clipboard
The lpci snap build errors out when using snapcraft 8.x but works fine with 7.x
Bug Description
We build the lpci
snap on the core20
base using the latest version of snapcraft
and the builds are breaking with the 8.x versions of snapcraft
due to mismatch between the installed pip
version (22.0.2
) and the expected version, 20.0.2
. https://launchpadlibrarian.net/709960065/buildlog_snap_ubuntu_focal_amd64_lpci_BUILDING.txt.gz contains the logs for a build failure due to this issue.
For now, we have worked around this issue on the Launchpad snap recipe for lpci
by pinning snapcraft
to the 7.x/stable
channel.
To Reproduce
- Clone the
lpci
code locally from https://git.launchpad.net/lpci. - Install the latest version of
snapcraft
. - Navigate to the top-level directory of the
lpci
repository and runsnapcraft -v
. - The build fails with an error about
pip
version conflict.
Environment
Snapcraft 8.0.2 on Kubuntu 23.10
snapcraft.yaml
https://git.launchpad.net/lpci/tree/snap/snapcraft.yaml
Relevant log output
Building lpci
+ snapcraftctl build
+ python3 -m venv /root/parts/lpci/install
+ SNAPCRAFT_PYTHON_VENV_INTERP_PATH=/root/parts/lpci/install/bin/python3
+ pip install -U wheel
Traceback (most recent call last):
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 22.0.2 (/snap/snapcraft/10436/usr/lib/python3/dist-packages), Requirement.parse('pip==20.0.2'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/stage/usr/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3252, in <module>
def _initialize_master_working_set():
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/root/parts/lpci/install/lib/python3.8/site-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==20.0.2' distribution was not found and is required by the application
Failed to build 'lpci'.
Recommended resolution:
Check the build logs and ensure the part's configuration and sources are correct.
Additional context
I tried pinning pip==20.0.2
in the python-packages
list as suggested in a related conversation on the #snapcraft
Matrix channel, but that didn't work because it just ran pip install pip==20.0.2 wheel
, which will not work.