python plugin doesn't work for namespace packages

Bug #1675479 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
High
Unassigned

Bug Description

snapcraft version: commit dbdaf36a43c7e5682d00e34552ce283f4ec1fc9d (this is the fix for https://bugs.launchpad.net/snapcraft/+bug/1670852).
snap: github.com/openstack/snap-keystone

When testing the above bug fix, I started hitting the following issue. Note: the above commit did fix the issue reported in that bug.

The snap installs successfully now. However, python dependencies aren't fully getting installed. I don't hit these issues on 2.22.

For example, after installing the snap, running a command from the snap I hit this: http://paste.ubuntu.com/24230185/
And /snap/keystone/current/lib/python2.7/site-packages/repoze/lru/ does in fact exist.
'touch /snap/keystone/current/lib/python2.7/site-packages/repoze/lru/__init__.py' got me past that issue.

Then starting a daemon 'sudo systemctl restart snap.keystone.api' I hit: http://paste.ubuntu.com/24230205/

Once again, 'touch /snap/keystone/x1/lib/python2.7/site-packages/paste/__init__.py' seemed to fix that issue.

It seems that the cause of this problem may be due to: https://github.com/pypa/pip/issues/1924

Leo Arias (elopio)
tags: added: openstack plugin
Changed in snapcraft:
status: New → Confirmed
importance: Undecided → High
Leo Arias (elopio)
Changed in snapcraft:
milestone: none → 2.29
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

I don't see that error, but I had to make modifications to your snapcraft.yaml -> http://paste.ubuntu.com/24327782/

the environment entries are currently broken in snapd. You also want to use a fixed python (the one in the snap to get the correct sitecustomize which gets PYTHONPATH just right).

What is missing here is the fact that you are not compiling your own python and are creating a classic snap. This will cause issues.

I'll mark this bug as invalid for now, but feel free to reopen or open a new one, but .pth files seem to work.

snapper@snap-testing:~$ $SNAP/usr/bin/python2
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from paste import deploy
>>>

^-- no exception ;-)

Changed in snapcraft:
status: Confirmed → Invalid
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Hey Sergio, so something must be different in our environments but I'm not sure what.

I'm still hitting this on xenial and zesty, using both the snapcraft snap and the deb:
  - snap: snapcraft 2.28 rev 19
  - deb: snapcraft 2.28+17.04

I've attached a new snapcraft.yaml that recreates it. Note this time around I'm compiling python2.7.

Changed in snapcraft:
status: Invalid → New
Revision history for this message
Corey Bryant (corey.bryant) wrote :

As a work around I've added the following to the keystone section:

install:
  touch $SNAPCRAFT_PART_INSTALL/lib/python2.7/site-packages/paste/__init__.py
  touch $SNAPCRAFT_PART_INSTALL/lib/python2.7/site-packages/repoze/__init__.py

Changed in snapcraft:
milestone: 2.29 → 2.30
Changed in snapcraft:
milestone: 2.30 → none
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.