Learning the Julia computer language on Ubuntu

There is yet another computer language, called Julia. What’s special with Julia, you may ask? It is a language specifically suited for tasks of scientists, engineers and students. Compared to a general purpose programming language, Julia has built-in those complex data types that you need in science. For example, multidimensional matrices are built-in in Julia.

In the following we are going to see

  • how to set up Julia 1.0.0 on Ubuntu
  • how to use Julia and learn the core language
  • how to add packages to Julia

Setting up Julia on Ubuntu

The current stable version of Julia is 1.0. It has been released recently after a lot of work. The previous stable version was 0.6. Many tutorials and add-on packages may not be fully up-to-date with version 1.0. However, this version 1.0 appears to be a big milestone to the project, therefore this is the one we are trying here.

Currently, the easiest way to install Julia is to use one of the pre-compiled installation packages from the download page.

There is a snap package called julia-stable (fmind), however you can use it only to test only the built-in features of the language. It has not been configured to access the Internet (therefore cannot install packages), does not embed the curl command that the Julia package manager needs, and also most Julia packages have dependencies like the Python3 language (PyPlot) and a web browser (Plots). These dependencies are not included. Ideally, a Julia snap package would need to have the classic confinement to work properly. I have not seen yet a request yet on forum.snapcraft.io for classic confinement for Julia.

Let’s go to the Julia Download page and get the appropriate pre-compiled tarball (Generic Linux Binaries for x86, 64-bit).

$ cd
$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.0-linux-x86_64.tar.gz
$ tar xvfa julia-1.0.0-linux-x86_64.tar.gz
$ ls -l julia-1.0.0/bin/
total 48
-rwxr-xr-x 1 myusername myusername 47280 Aug 9 04:02 julia

Let’s put this path (~/julia-1.0.0/bin/) into the $PATH so that we can invoke julia from any directory. Then, use the source shell command to read again the .profile configuration file. After that, we are ready to run Julia.

$ echo PATH=\$PATH:~/julia-1.0.0/bin/ >> ~/.profile
$ source ~/.profile

Here is our first run of Julia!

Running Julia for the first time.

To exit, you can either run exit() or press Ctrl-D.

There is one more important detail before we actually do useful things with Julia. Julia 1.0 has a new package manager to install Julia packages. This package manager used to be called Pkg3 but now it has replaced the old package manager called Pkg, and reuses the old name Pkg. During this change, the Pkg package is not autoloaded when you run Julia, and you need to load it whenever you run Julia. Older Julia tutorials assume that the Pkg package is already loaded, therefore if we do not fix this issue, you may find it frustrating when learning the language. Therefore, let’s autoload Pkg. To do so, we edit the Julia 1.0 startup file startup.jl, and add in there the instruction using Pkg.$ mkdir ~/.ju

$ mkdir -p ~/.julia/config/
$ echo "using Pkg" >> ~/.julia/config/startup.jl

That’s it. Let’s use Julia now.

Using Julia

Here is the HelloWorld, in Julia. We also show how to exit.

HelloWorld in the Julia computer language.

Julia has similar commands  to all sort of tasks that you can do with a general-purpose programming language. Here are some recommended tutorials to get you started.

When you learn Julia, you learn the core Julia language, and then you learn useful available packages that help you perform your tasks. In the following we cover issues that you may get when you setup and use packages in Julia.

Adding packages

What makes Julia really useful, is that there are many packages to choose from. There are almost 2000 available Julia packages. You can make a better sense as to which packages are more important by viewing the list of top Julia packages.


In the following we do plots. There is a dedicated Julia Plots website for this, and explains that we need to install the basic Plots package, and then select a plotting back-end. In the following, Plots automatically selected the GR plotting back-end.

Here is the current state of Julia 1.0 support of the plotting back-ends.

  • GR. Supported in Julia 1.0, and invokes the program gksqt to view the graph. That’s a QT application. When it starts, it shows a small window that you can resize in order to view the plot.
  • PyPlot. Not supported yet in Julia 1.0. It gets compiled but fails when you try to actually create a plot.
  • PlotlyJS. Supported in Julia 1.0. Invokes your Web browser to show the plot. Has Javascript code in the plot that helps to view, pan, save, etc. See the PlotlyJS page on how to install the dependencies.
  • UnicodePlots. Supported in Julia 1.0. Uses Unicode characters  (text) to display the plots. Their page has many easy-to-use examples.
  • Gadfly. Almost supported in Julia 1.0. Follow this bug report to figure out when this back-end gets fully supported in Julia.

Here are some screenshots of plots.

Generated with the plotlyJS backend. When you hover the mouse pointer at the top of the plot, you get extra tools like saving to PNG, panning, resizing, zoom and more.
Generated with the UnicodePlots backend. Makes use of available Unicode characters to give the illusion of a graph in text mode. I think these are Braille Unicode characters.
Generated with the GR backend. The histogram command was histogram(randn(10000)).


This has been an introduction to Julia. You can use the online environments to run Julia programs, or you can also try to run on your Ubuntu.  Evaluate Julia and see whether learning this computer language will be useful to you.

Permanent link to this article: https://blog.simos.info/learning-the-julia-computer-language-on-ubuntu/

1 ping

  1. […] Learning the Julia computer language on Ubuntu […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: