holzschu / a-Shell-commands

shell commands, pre-compiled to webAssembly, ready to use in a-Shell
599 stars 22 forks source link

Add scipy #47

Closed CarlGao4 closed 7 months ago

CarlGao4 commented 7 months ago

Is it possible?

holzschu commented 7 months ago

Adding scipy through the a-Shell-commands mechanism is not possible: scipy needs to be integrated with the existing Python in a-Shell, so it would have to be using native Arm64 binaries, not WebAssembly. Native Arm64 binaries have to be present in the app when the app is being reviewed by Apple, so they have to be present at install time. It's technically possible (after all, Scipy is already integrated with Carnets-Jupyter, and a-Shell shares a lot of code with Carnets), but it would significantly increase the size of the app. It will be done, but not immediately.

CarlGao4 commented 7 months ago

I have another idea. Though adding binaries is not allowed in iOS apps, adding dylib seems possible. Last time I manually installed torch (built for M1 Mac) on iPad and the error is that the dylib is built for macOS but not iPadOS. Maybe we can use numpy as a test, by building a NumPy wheel and install it in a-Shell mini. If it succeeds, then we can open a new PyPI repo and use it to host installable Python packages

holzschu commented 7 months ago

I'm afraid I already tried that. You can add a dynamic library, but you cannot open it. You can only open a dynamic library if:

CarlGao4 commented 7 months ago

What if it is a symbolic link? I mean, we just put a symbolic link in the place it could be opened, pointing to a path which does not exist, and it would be available once the user has installed it

holzschu commented 7 months ago

Symbolic links are forbidden inside the entire $APPDIR directory (I know this because I accidentally left one at some time, and the app was summarily rejected). There is also the fact that you do not know in advance the position of $HOME, which is the directory where you can write as you want, since it contains a UUID that is recomputed at each reboot (try pwd -P to see what I mean).
You have to keep in mind that Apple has spent a lot of time perfecting their system against any kind of attack, so anything obvious is unlikely to work. And adding dynamic libraries to an existing app is useful for Python, but it's also exactly the kind of stuff an attacker would do.

CarlGao4 commented 7 months ago

I understand. Besides, I remember that scipy is not so big, like only 50MB?