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.
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.
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 方式调用动态库完成相应功能的应用
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
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
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?
发件人:“David Lane via snapcraft.io” forum@forum.snapcraft.io
收件人:zzzzzzzzzzz1@sina.com
主题:[store-requests] Classic confinement for koutu2-zs
日期:2023年06月01日 08点22分
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.