Python plugins fails to build a snap when some parts depends on unpublished modules
Metadata
Current evaluation
Closed without resolution. The Python plugin fails to build snaps when parts depend on unpublished local modules because pip download fails to locate them on PyPI. No fix was implemented.
Suggested action: —
No scores available.
Issue body
Hello,
I described the full case here: https://forum.snapcraft.io/t/building-a-snap-with-a-multi-python-project/12284
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: https://github.com/snapcore/snapcraft/blob/6c3e3ab9acbf672760141f6456c3c47a92899fb3/snapcraft/plugins/python.py#L338
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: https://github.com/adferrand/snapcraft-python-showcase
I am available for any question on that matter.
Regards,
Adrien Ferrand
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The Python plugin fails to build snaps when parts depend on unpublished local modules because pip download fails to locate them on PyPI. No fix was implemented. | |
| qwen/qwen3.6-35b-a3b | — | — | The issue reported that the Python plugin fails to build snaps with unpublished local dependencies because pip download cannot find them on PyPI. The issue was closed with no activity, indicating it was abandoned. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1860884 Python plugin: paths for from the snapcraft snap in sys.path break dependencies | snapcraft (launchpad) | closed | Abandoned due to inactivity. The Python plugin incorrectly included snapcraft snap paths in sys.path during builds, causing dependency conflicts. No resolution or fix was implemented. | |
| #1723898 Unable to build snaps using python plugin - pypi.debian.net no longer accessible | snapcraft (launchpad) | closed | Closed as resolved. The pypi.debian.net service outage was temporary and resolved. No code changes were needed since the build failures stemmed from an unavailable third-party host rather than a snapcraft bug. | |
| #1631057 python plugin "No module named site" | snapcraft (launchpad) | closed | Closed without resolution. The python plugin triggered a missing site module error during snap builds when fetching bzr dependencies, but no fix or follow-up was provided. | |
| #1794216 python plugin parts errors with "ERROR: You must give at least one requirement to install" when rebuilding | snapcraft (launchpad) | closed | Closed and fixed. The snapcraft python plugin rebuild failure with pip was resolved in a later release, addressing the build caching issue. |