Using Julia on Android with UserLAnd

The purpose of this post is to teach a way to use the Julia language on an Android smartphone.
PS. Sorry for my English

Step 1

Download these apps:

  • UserLAnd (Linux emulator)
  • CodeBoard (Optional. A custom keyboard for programming.)
  • Via (Pluto.jl has a bug when typing in a indented code block in a mobile browser. Via emulates a PC browser while maintaining the mobile layout.)

Step 2

Open UserLAnd and download the Debian distro. Select the SSH option, enter the username and password, then wait for the download to finish.

Step 3

When the installation of Debian is finished, a terminal will appear. Enter your user password. Click enter.

Now we are going to update Debian’s dependencies. Paste the command below into the terminal and click enter.

sudo apt-get update && sudo apt-get upgrade -y

Having finished the update, let’s download the wget. Paste the command below into the terminal and click enter.

sudo apt-get install wget -y

Now let’s download Julia. Paste the command below into the terminal and click enter.

wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.6/julia-1.6.0-linux-aarch64.tar.gz

Next step, extract the downloaded file. Paste the command below into the terminal and click enter.

tar -xvzf julia-1.6.0-linux-aarch64.tar.gz

Having extracted the file, it is no longer needed. To delete the file, paste the command below into the terminal and click enter.

rm julia-1.6.0-linux-aarch64.tar.gz

Last step, create a symbolic link to the Julia language. Paste the command below into the terminal and click enter.

cd
mkdir bin
echo "export PATH=\$HOME/bin:\$PATH" >> ~/.bashrc
. ~/.bashrc

After that last command, paste the command below into the terminal and click enter.

ln -s "$HOME"/julia-1.6.0/bin/julia "$HOME"/bin

Run Julia!

Run Julia with the julia command. Enter PKG mode, and install Pluto.jl.

After installing Pluto.jl, start a Pluto.jl server and copy the link.
using Pluto; Pluto.run()

For a better experience with Pluto.jl use the Via browser. Open Via, on the toolbar click the options icon > tools > user agent. Select the “Chrome PC” option.

Now paste the Pluto.jl link in the Via address bar and start programming!

Obs.: Plots.jl does not run.

12 Likes

This is brilliant!
Would you know how to increase the font size?
Tried command below but no luck:

gsettings set org.gnome.desktop.interface text-scaling-factor 2
1 Like

Sorry @rafael.guerra. I don’t know how to change the terminal font size.

@eliascarv, fyi the two-finger zoom technique seems to work fine and to stick.
Many thanks for your great post.

1 Like

You’re welcome! I didn’t know that the zoom gesture worked. I ended up learning something new too.

New commands for Julia 1.6.1:

sudo apt-get update && sudo apt-get upgrade -y

sudo apt-get install wget -y

wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.6/julia-1.6.1-linux-aarch64.tar.gz

tar -xvzf julia-1.6.1-linux-aarch64.tar.gz

rm julia-1.6.1-linux-aarch64.tar.gz

cd
mkdir bin
echo "export PATH=\$HOME/bin:\$PATH" >> ~/.bashrc
. ~/.bashrc

ln -s "$HOME"/julia-1.6.1/bin/julia "$HOME"/bin

5 Likes

Thanks for the good stuff.
Maybe it would be helpful to also add instructions to remove the symbolic link to the previous julia version, and to remove the previous installation?

Also, would you know how to easily install in this case, the beautiful JuliaMono fonts?

1 Like

To remove the old version of Julia, delete the old directory with the following command:
rm -r julia-1.6.0

To remove the symbolic link from the old version of Julia, go to the bin folder with the following command:
cd bin
Then, delete the symbolic link with the following command:
rm julia

After doing this, you can download the new version of Julia normally:
wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.6/julia-1.6.1-linux-aarch64.tar.gz

tar -xvzf julia-1.6.1-linux-aarch64.tar.gz

rm julia-1.6.1-linux-aarch64.tar.gz

And finally, create the symbolic link for the new version:
ln -s "$HOME"/julia-1.6.1/bin/julia "$HOME"/bin

1 Like

Regarding changing the source of the terminal, I don’t know if it is possible.

1 Like

Followed instructions from @cormullion posted here and all steps below could be performed alright.

However, no signs of JuliaMono fonts after creating the local.conf file, restarting UserLand, Debian linux and Julia 1.6.1:

cd /usr/share/fonts/truetype/

wget https://github.com/cormullion/juliamono/raw/master/juliamono-ttf.zip

sudo apt install unzip
unzip juliamono-ttf.zip
rm -r juliamono-ttf.zip

sudo apt install font-manager

$ fc-cache -f -v

sudo apt install nano

nano /etc/fonts/local.conf
# create file with content:
<alias>
    <family>monospace</family>
    <prefer>
            <family>JuliaMono</family>
        </prefer>
</alias>
1 Like

I have been using Julia via Termux on Android for a while. I don’t remember anything more complicated than downloading it, though.

@Peter_Adelman, are you using JuliaMono fonts?

PS: changed Termux for UserLand because found the latter very simple to install and to run Julia.

This JuliaMono fonts business is another story.

1 Like

Does this thread suggest Julia is available on the newer Samsung cellphones?

Julia 1.6.1 on Nokia 8.1 with Android 11:

6 Likes

Not sure what you mean by newer Samsung cellphones exactly, but I have Julia 1.6.1 running using this procedure on Samsung Tab S3 (Android 9, kernel v3.18, OneUI v1.1) as well as Samsung A40 (Android 11, kernel v4.4, OneUI v3.1). Neither is really “new”, but just to show that it works on a range of android versions on Samsung devices including the current release. Since Android 10 UserLAnd cannot grant blanket access to the SD card but that’s a known UserLAnd issue not specific to Samsung, and the issue including workarounds is explained in the app’s wiki.

2 Likes

I had successfully installed jupyter notebook for julia in arch linux on an Android cell phone. It was really nice.

1 Like

Installed latest UserLand App for Android and had to use modified command:
wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.7/julia-1.7.3-linux-aarch64.tar.gz --no-check-certificate

Then ran into trouble, with Julia launching but then immediately crashing with following error:

SYSTEM: caught exception of type
SYSTEM: caught exception of type

^Cfatal: error thrown and no exception handler available.
InterruptException()
jl_mutex_unlock at /buildworker/worker/package_linuxaarch64/build/src/julia_locks.h:129 [inlined]
jl_task_get_next at /buildworker/worker/package_linuxaarch64/build/src/partr.c:484
poptask at ./task.jl:862
wait at ./task.jl:871
task_done_hook at ./task.jl:579
_jl_invoke at /buildworker/worker/package_linuxaarch64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linuxaarch64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linuxaarch64/build/src/julia.h:1788 [inlined]
jl_finish_task at /buildworker/worker/package_linuxaarch64/build/src/task.c:218
start_task at /buildworker/worker/package_linuxaarch64/build/src/task.c:888
userland@localhost:~/julia-1.7.3/bin$

Any advice? Thanks in advance.

1 Like

Has anyone managed to install the latest UserLand Android app and run Julia?

Linking related thread.

1 Like

Android has over 2.8 billion active users and holds a global market share of 75%. So here it goes a shout-out for play, do, learn Julia on Android.

3 Likes

I usually use Julia on Android via Termux installed by FDroid:

1 Like