Categories
_NOTES_ Tools

Tutorial: Running Wolfram Mathematica $($RPi ARM64 version$) $Locally on iPad Pro with Apple Silicon M1 Chip on UTM-based Debian12-on-ARM64 VM

Although the existence of Wolfram Cloud has allowed us to access Wolfram engine from almost any Internet-connected device, there has always been a temptation to deploy and run Mathematica on mobile devices due to performance, response time, Internet dependency, connection quality, and many other factors. This point is particularly prominent at the moment when the computing power of mobile devices has significantly expanded over the past few years.

The biggest obstacle in trying to do this is that most mobile devices are based on arm64 architecture processors, while almost all distributions of Mathematica on Mac OS, Win, Linux, and even versions that rely on docker containers on Linux require the platform architecture to be x86/x86-64/amd64. The sole commonly seen ARM64-based Mathematica distro is the one developed for AppleSilicon-based new Macs. But the difficulty of deploying a mac OS-like environment on a mobile platform seems to be more than enough to abandon the project

The biggest obstacle in trying to do this is that most mobile devices are based on arm64 architecture processors, while almost all distributions of Mathematica on Mac OS, Win, Linux, and even versions that rely on docker containers on Linux require the platform architecture to be x86/x86-64/amd64. The  sole commonly seen ARM64-based Mathematica distro is the one developed for AppleSilicon-based new Macs. But the difficulty of deploying a mac OS-like environment on a mobile platform seems to be more than enough to abandon the project.

Fortunately, we do have some distro of Mathematica that runs on a ARM64/ARMhf platform, the one that was developed to be deployed on a Raspberrry Pi. This version of Wolfram engine actually runs on a Ubuntu-on-ARM distro for RPi. So we tried to install this version of Wolfram engine on a Ubuntu22.04 VM running on UTM, by directly dpkg its .deb file instead of bash a shell installation script, to avoid potential source connecting problems. However, this method also turned out to be ineffective due to dependency problems. I’m not so familiar with Linux system structure and failed to fix these problems.

However, to my surprise and delight, when I repeated the exact process above on a Debbian12-on-ARM VM by chance,  it turned out all dependency issues had gone and the only problem we encountered, which was easy to fix, was the lack of some packages of the native net-installed Debian system. We simply apt install these packages and then Wolfram engine and GUI Mathematica can then be activated by a Linux-version activating key.

After some adjustment of VM parameters, this system constructed on a iPad Pro with M1 chip got a score about 2.5 on Mathematica benchmark.

A performance test can be viewed on my Bilibili page

Tutorial

I. The first step is to install UTM, the environment our VMs to be deployed

First install the latest version of Sideloady on your Mac;

Download the TrollinstallerXipa file on you Mac and cable connect your iPad. Side load the ipa by Sideloadly to your iPad;

Trust Trolinstaller^ sideloaded on your iPad, open and run it. If failed, try reboot and try again;

Now Trollstore2II. Deploy Debian12 VM on UTM has been installed on your iPad, find the proper ipa file of UTM on its release page on github and then you can install UTM on your device by Trollstore2.

II. Deploy Debian12 VM on UTM

Find the net install image of Debian12 on its official website, download it to your iPad;

Open UTM, create your VM by virtualization, which is much faster, if you are iOS version is under upmost 16.3.1; or by emulation if your system disabled virtualzion option;

Follow th instruction to install Debian12 onto your iPad, because we are not-installing the system, keep your internet connection when installing the system; an optional step that can directly avoid the package issue you may encounter when pkg Wolfram-engine later is to install all optional desktop environments when installing the system;

Remove the CD image and reboot the VM, now you have a Debian12 VM on your iPad.

III. Install Wolfram engine on your Debian12 VM

First download the .deb installing file from RPi website;

Open terminal on the directory where you have download the .deb file, running the following script with filename replaced properly;

sudo dpkg -i filename.deb

Moments later your will see the configuration interface of wolfram-engine, agree the licenses then you are automatically proceeded to installation;

You should have properly installed Wolfram engine and Mathematica now, but if package errors occur, you may run the following script to install the package needed:

sudo apt install packagename

Leave a Reply

Your email address will not be published. Required fields are marked *