Classic confinement for `koutu2-zs`

Hello administrator:

The application I tried to submit uses Classic confinement because it is an application that calls a deep learning model;

the operation of the deep learning framework pytorch requires a huge runtime library, ranging from a few hundred M to a G size, which is difficult to directly Put it into the installation package; (1.6G /usr/local/lib/python3.10/dist-packages/torch)

The way I deal with this problem is to search for the local system first, and install it through apt and pip if it fails;

I tried the implementation after changing the confinement to devmode, but it is completely inoperable.

Thank you, especially emitorino’s direct help


“koutu2-zs”使用“Classic confinement”的原因

管理员好:

我尝试提交的应用之所以使用 Classic confinement,是因为这是一个调用深度学习模型的应用;

深度学习框架 pytorch 的运行需要庞大的运行时库,少则几百M多则上G的大小,难以直接打入安装包中;(1.6G /usr/local/lib/python3.10/dist-packages/torch)

我处理该问题的方法是先在本机系统寻找,未果后便通过 apt、pip 来安装;

我尝试了把 confinement 改为 devmode 后的实现情况,已然完全无法运行。

谢谢,尤其感谢 emitorino 的直接出手帮助

I’m wondering what’s rendered this inoperable?

If you install the package via PIP via classic, you’re either going to:

  • Place the package in the native system, which might make it conflict with packages already on the host, and gives you more stuff to manage. The majority of hosts are unlikely to have a compatible version of Python, and the end result might easily end up being ABi incompatibility and headaches.
  • Place the package isolated away from the native system, where it can’t be shared with anything else, and still creates you extra overhead because rather than just updating the snap and having a clean envionment guaranteed, you’ll have to micromanage the Python environment around it.

PyTorch might be massive to bundle, but the bundling has extreme benefits for your long term maintenance.

FWIW, even outside of bundling in the snap itself, you can still get PyTorch working via PIP post-install even in a strict snap, for example, give this a go:

sudo snap install root-framework

pyroot
> import torch

This will fail, because that snap doesn’t bundle Torch

root-framework.pip install torch

pyroot
> import torch

This will now work.

So using classic to download PIP packages at runtime might also not be necessary, but I’d still advise against it to make things easier on yourself.

First of all, thank you for your detailed reply

It’s just that my application is not written by Python, but, to put it simply, it’s an application that calls the dynamic library in C mode to complete the corresponding functions

The reason for using pip is that it is the fastest way I can find to install the torch runtime library

The purpose of using “classic” is not to forcibly install a copy of the torch runtime library locally, but to check whether there is a local installation. If there is, use it directly, or install it if there is no local installation

The local installation through pip is of course compatible with the local installation, and the so-called conflict will not occur naturally

I wonder if it will help you understand. Thanks again


首先谢谢你这么详尽的回复

只是,我这个应用其实并非由 python 编写,而是,简单地说,是 C 方式调用动态库完成相应功能的应用

之所以用到 pip,是因为这是我目前能够找到的最快捷的安装 torch 运行时库的方式

而使用“classic”的目的也非想强行安装一份 torch 运行时库到本地,而是先查看本地有无安装,有则直接使用,无则安装

通过 pip 进行的本地安装当然便是兼容本地的安装,自然也不会出现所谓冲突

不知是否有助你的理解,再次感谢

I think I should explain it more complicated

This application is actually a combination of the interpreter library developed by rustlang, the general interface program and tool library developed by C++, and the script

The dependencies listed when the snap is packaged meet the requirements of the above program, but do not include the dependencies of the deep learning framework library


我想我或许应更复杂地来解释

这个应用其实是由 rustlang 开发的解释器库、C++ 开发的通用界面程序和工具库,以及脚本糅合而成

snap 打包时所列出的依赖满足了上述程序的运行,但没有包含深度学习框架库的依赖

Would it be possible to include the dependencies of the deep learning framework library? Then I assume this snap would not need classic confinement. ie. can this snap ship the torch runtime itself rather than trying to use one that may or may not already be installed locally?

Thank you for your suggestion. I can’t find out how to add dependencies when this package is packaged. I’ll try again later

However, I think there will be more and more desktop applications for in-depth learning in the future. If each application takes up several gigabytes of space, it is really unacceptable for me personally, To go further, when I install a new system, I usually only assign it 20G

To some extent, my pursuit of sharing local installation libraries has escaped the sandbox restrictions of snap, so if it is difficult to pass the audit for this reason, I will give up submitting

Thanks again


多谢你的建议,这个包打包其时我尚未能找到依赖项如何来加,后面再尝试下

只是,我想以后深度学习的桌面应用当是越来越多,如若每个应用都占用几G空间,于我个人而言实在难以接受, 扯得远一点,我安装一个新系统一般也只是分配给它20G

某种程度上,我所实现的追求共用本地安装库的方式已经逃离了 snap 的沙箱限制,所以难以通过审核因这个缘故的话,那我就放弃提交了

再次感谢

Hello @zzzzzzzzzzzc and thank you for all the detailed information you’ve shared. Given where the conversation has ended, I will remove this request from our review queue. If you decide to work on this snap again in the future and still think that classic might be needed then free to re-use this thread. Thank you.

Hello, thank you very much for your understanding.

On the day I received your email, I had a perhaps childish idea, ‘Submit again and see how it works,’ but I laughed it off later.

I want to inquire about some questions now, not about development, but not necessarily about finding the right person through forums. If you can and are willing to reply.

When I looked at the document before, I found that in the national language category, there was traditional Chinese instead of simplified Chinese. I was a bit curious, but your software store should be international. Have you given up on such a huge piece of China?

Best regards and best wishes

你好,多谢你的知会。 我收到你的邮件的当日真有一个也许称之幼稚亦可的想法,“再次提交试看如何”,不过我后来一笑而过了。 我现在是想咨询些问题,不是开发方面的通过论坛却不一定找对人的问题,如果你可以并且乐意回复的话。 之前看文档时发现国家语言一项中,没有简体中文却有繁体中文,我有些好奇,你们软件商店应该是国际性的啊,难道放弃了中国这么巨大的一块? 此致,祝好

发件人:“David Lane via snapcraft.ioforum@forum.snapcraft.io 收件人:zzzzzzzzzzz1@sina.com 主题:[store-requests] Classic confinement for koutu2-zs 日期:2023年06月01日 08点22分

dclane
June 1

Hello @zzzzzzzzzzzc and thank you for all the detailed information you’ve shared. Given where the conversation has ended, I will remove this request from our review queue. If you decide to work on this snap again in the future and still think that classic might be needed then free to re-use this thread. Thank you.