Snapcraft only includes lib/python*/site-packages in site

Bug #1715406 reported by Evan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Triaged
High
Sergio Schvezov

Bug Description

Debugging why `import google.protobuf` wasn't working inside a snap, I found that snapcraft only puts $SNAP/lib/python*/site-packages into site.addsitedir(). As I was using pip inside a scriptlet without additional environment variables or command line parameters, it was installing the modules to $SNAP/usr/lib/python*/site-packages. This meant that python was looking in the wrong place for protobuf-3.4.0-py2.7-nspkg.pth.

Can we include $SNAP/usr/lib in a list fed to site.addsitedir()?

Revision history for this message
Evan (ev) wrote :
Revision history for this message
Evan (ev) wrote :
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Can you call the python that is in $SNAPCRAFT_PART_INSTALL/bin/python instead of calling python from the host?

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Regardless, I'll look into this this week.

Revision history for this message
Evan (ev) wrote :

> Can you call the python that is in $SNAPCRAFT_PART_INSTALL/bin/python instead of calling python from the host?

Unless I've misunderstood I'm already doing that on https://github.com/evandandrea/tensorflow-snap/blob/86d3eb919522aeed188861b5e93e38a105b0b5c9/snapcraft.yaml#L52

Revision history for this message
Evan (ev) wrote :

In case it wasn't clear: "and this is where we started" is what the tensorflow team came up with and "for reference" is the final version I wrote.

Changed in snapcraft:
milestone: none → 2.35
assignee: nobody → Sergio Schvezov (sergiusens)
importance: Undecided → High
status: New → Triaged
Changed in snapcraft:
status: Triaged → Confirmed
Changed in snapcraft:
milestone: 2.35 → none
Changed in snapcraft:
status: Confirmed → Triaged
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.