Comment 18 for bug 1904945

Revision history for this message
Chris Patterson (cjp256) wrote :

The change to use sys.base_prefix has caused a regression in at least one python snap (Charmcraft). The effect of this change caused core20 python snaps to now revert to using '/usr' base_prefix when looking for wheels rather than the virtual environment root, effectively $SNAP.

For example:
>>> sys.prefix
'/snap/charmcraft/x1'
>>> sys.base_prefix
'/usr'

This prevented wheels from inside the snap from being loaded. We worked around this using a snap layout in a strict snap to put the python wheels in the newly expected location. For example:

```
layout:
  /usr/share/python-wheels:
    bind: $SNAP/share/python-wheels
```

I wonder if it really should even be loading the host's wheels when inside a virtual env? With `python3 -m venv` the wheels appear to be copied into the virtual env. `virtualenv` seems to ship its own embedded variants.