gramineproject / examples

Sample applications configs for Gramine
BSD 3-Clause "New" or "Revised" License
29 stars 22 forks source link

Update PyTorch manifest template #63

Closed dimakuv closed 1 year ago

dimakuv commented 1 year ago

OLD TEXT: PyTorch README describes local (non-root) installation. However, the manifest template worked only with system-wide (root) installation. This was because Gramine couldn't find where torchvision was installed.

This PR has several fixes:

Local installation on my random Ubuntu 22.04 machine is like this:

~/examples/pytorch$ pip3 show torchvision pillow
Name: torchvision
Version: 0.15.1
...
Location: /home/sdp/.local/lib/python3.10/site-packages
---
Name: Pillow
Version: 9.0.1
...
Location: /usr/lib/python3/dist-packages

The system-wide installation on the same machine is like this:


~/examples/pytorch$ sudo pip3 show torchvision pillow
Name: torchvision
Version: 0.15.1
...
Location: /usr/local/lib/python3.10/dist-packages
---
Name: Pillow
Version: 9.0.1
...
Location: /usr/lib/python3/dist-packages

For context, see also:


This change is Reviewable

anjalirai-intel commented 1 year ago

pytorch/pytorch.manifest.template line 45 at r1 (raw file):

  "file:/usr/{{ arch_libdir }}/",
  "file:{{ python.stdlib }}/",
  "file:{{ python.distlib }}/",

A query here, Can we also remove python.distlib and replace it with python.get_sys_path(entrypoint) % becauase some distros does not have distlib

anjalirai-intel commented 1 year ago

pytorch/pytorch.manifest.template line 25 at r2 (raw file):

  { path = "{{ path }}", uri = "file:{{ path }}" },
{% endfor %}
  { path = "{{ pillow_path }}", uri = "file:{{ pillow_path }}" },

pillow_path and torchvision_path will be present as python.get_sys_path. These are duplicate entries

anjalirai-intel commented 1 year ago
Previously, dimakuv (Dmitrii Kuvaiskii) wrote…
@anjalirai-intel Ping. Could you verify?

Sure

anjalirai-intel commented 1 year ago
Previously, anjalirai-intel wrote…
Sure

Verified on Ubuntu 22.04, it passed