Python plugins fails to build a snap when some parts depends on unpublished modules

Bug #1841861 reported by Adrien Ferrand on 2019-08-28
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Sergio Schvezov

Bug Description


I described the full case here:

To sum up, let's suppose that you have two python projects, project1 and project2, lying in the same GIT repository. You are building a snap that consists in two parts, one for each project.

However, project2 depends on project1 in its current state, with new features added in project2 that are not yet release. Typically project2 will declare a dependency project1>=0.1.dev0.

Out of the snaps, this situation is OK for pip, since it will install project1 in the local site package, then will successfully install project2 since a compatible version of project1 is already available. However, snapcraft will fail in the same situation, complaining that it cannot find the required version of project1 in PyPI.

I checked the code of python plugin. In theory nothing prevents snapcraft to do the same thing than pip, since the sitecustomize module is properly set up to find packages from the other parts already compiled.

However, the root cause here is this line of code:

This line ask to invoke `pip download` for the set of requirements declared by a given part. And it will fail because it cannot find the required version for project1.

Funny thing is that in fact, the snap would be built perfectly without this, since the invocation of `pip install` after will successfully find the packages from the already installed snaps.

I made a showcase project (python projects + snapcraf.yml) that focuses on this error, if someone wants a clear target to fix this:

I am available for any question on that matter.

Adrien Ferrand

Changed in snapcraft:
importance: Undecided → High
status: New → In Progress
assignee: nobody → Sergio Schvezov (sergiusens)
Changed in snapcraft:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers