It is not possible to build a python snap that has requirements

Bug #1712634 reported by Leo Arias
This bug affects 5 people
Affects Status Importance Assigned to Milestone

Bug Description

There are some python projects that have dependencies on their This is probably a bad practice but we can see it in offlineimap [1] and rasterio [2], so we should probably have to support it in a nice way.

If the snapcraft.yaml is not on the same repository as the, we have a way to make it work like popey did in [3].

However, if we want the snapcraft.yaml in the same repo, the separate part for the setup dependencies will not work. The python plugin will see the and try to install it, even in the separate part.

This is because the default source is `.`. Maybe, we should support a `source: nil`, that is useful only to install stuff in stage, that's required for other parts, but doesn't assume that it has a source directory.

I made a dirty workaround, using `source: snap`, which will find only the snapcraft.yaml in the dir so it will not try to install the


Revision history for this message
Leo Arias (elopio) wrote :
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Yeah i got confused about that too.
Somehow it should be possible to process requirements.txt without loading

I've added try: except ImportError: statements to my and I have both requirements.txt and build-package: stanzas to install the same thing.

Very redundant.

Cris Dywan (kalikiana)
Changed in snapcraft:
status: New → Confirmed
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

The default `source: .` is the real problem here and we should fix that (with a potential break on some projects).

Changed in snapcraft:
status: Confirmed → Triaged
importance: Undecided → High
Revision history for this message
Leo Arias (elopio) wrote :

This also affects raiden:

The workaround there is a little different, because we need to install requirements before running Then, I added a dependent part, with the hack to delete the on prepare.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.