Book Image

Julia Programming Projects

By : Adrian Salceanu
Book Image

Julia Programming Projects

By: Adrian Salceanu

Overview of this book

Julia is a new programming language that offers a unique combination of performance and productivity. Its powerful features, friendly syntax, and speed are attracting a growing number of adopters from Python, R, and Matlab, effectively raising the bar for modern general and scientific computing. After six years in the making, Julia has reached version 1.0. Now is the perfect time to learn it, due to its large-scale adoption across a wide range of domains, including fintech, biotech, education, and AI. Beginning with an introduction to the language, Julia Programming Projects goes on to illustrate how to analyze the Iris dataset using DataFrames. You will explore functions and the type system, methods, and multiple dispatch while building a web scraper and a web app. Next, you'll delve into machine learning, where you'll build a books recommender system. You will also see how to apply unsupervised machine learning to perform clustering on the San Francisco business database. After metaprogramming, the final chapters will discuss dates and time, time series analysis, visualization, and forecasting. We'll close with package development, documenting, testing and benchmarking. By the end of the book, you will have gained the practical knowledge to build real-world applications in Julia.
Table of Contents (19 chapters)
Title Page
Copyright and Credits
About Packt

Installing Julia

If the previous section convinced you to use Julia for your next project, or at least made you curious to learn more, then it's time to set up your Julia development environment.

Julia has superb cross-platform support, running on all major operating systems. The install process is straightforward—the language can be set up on your local machine, in a virtual machine (VM), in a Docker container, or on a server somewhere in the cloud.

Let's start by looking at local installation options for the big three operating systems (Windows, Linux, and macOS). Feel free to skip directly to the right one for you.


Windows has come a long way as a development platform and there are a few good alternatives for getting Julia up and running.

Official Windows installer

The simplest option is to download the Windows installer corresponding to your platform (32 or 64-bit), from Get the .exe and run it. Follow the standard installation procedure and in the end, you will have Julia installed as a program. Double-clicking julia.exe opens a command prompt with the Julia REPL, just like the one illustrated here:

Using Chocolatey

Chocolatey is a package manager for Windows, similar to apt or yum on Linux, or brew on Mac. If you don't have it, get it by following the instructions at

Chocolatey has the latest version of Julia, as can be confirmed with a search, as follows:

$ choco search julia 
Chocolatey v0.10.11 
Julia 1.0.0 [Approved] 
1 packages found. 

Installing is as simple as this:

$ choco install julia 
Chocolatey v0.10.11 
Installing the following packages: 
By installing you accept licenses for the packages. 
Progress: Downloading Julia 1.0.0... 100% 
Julia v1.0.0 [Approved] 
Chocolatey installed 1/1 packages.

Windows Subsystem for Linux

One of the recent additions to Windows 10 is the Subsystem for Linux. This allows setting up a Linux development environment, including most command-line tools, utilities, and applications—directly on Windows, unmodified, and without the overhead of running a VM.

In order to be able to use the Linux Subsystem your PC must be running the 64-bit version of Windows 10 Anniversary Update or later (build 1607+). It also needs to be enabled first—so open a PowerShell as an administrator and run the following:

$ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 

Once the subsystem is enabled (computer restart might be required) you can choose one of the Linux versions available, directly from the Windows Store. At the time of writing, five versions were available—Ubuntu, openSUSE , SLES, Debian, and Kali.

Ubuntu is the default option for Windows 10 and has the best user ratings in the Windows Store, so let's go with that. It can be installed from Alternatively, you can just open a command prompt and type $ bash. This will trigger the installation of the Ubuntu Linux Subsystem.

Once you find yourself at the shell prompt of your Linux subsystem, you can proceed and issue the commands for installing Julia. For Ubuntu you need to run the following:

$ sudo apt-get install julia

Make sure to confirm the required selections—then after a couple of minutes you should have Julia up and running.


Installing Julia on macOS is straightforward. There are two main options, depending on whether you prefer a visual installer or are more at home in front of the Terminal prompt.

Official image

Visit and look for the macOS package (.dmg). Once it's downloaded, double-click the .dmg file and drag and drop the Julia app into the /Applications folder. Now you can simply open the Julia app—which in turn will launch a new Terminal session, loading the Julia environment, as follows:


Homebrew is a well-known package manager for macOS in the line of apt and yum on Linux. It's not really necessary for installing Julia, but it's worth setting it up as it can be very useful during development since it can seamlessly install database servers, libraries, and other components for your projects.

As per the instructions at, it can be installed by running the following command in a Terminal window:

$ /usr/bin/ruby -e "$(curl -fsSL"

It might take a while but once Homebrew is installed, a new command-line utility, brew, will become available.

Finally, $ brew cask install julia will download and install the latest version of Julia. In the process, it will also link the julia binary to /usr/local/bin/julia so you can interact with the language from the command line by simply typing $ julia.

As soon as you get the confirmation that the installation was successful you can run $ julia to start a new REPL session:

Linux and FreeBSD

Julia is already available in the software repositories of the major Linux distributions, but unfortunately, these are not up to date. For example, at the time of writing, Ubuntu was providing v0.4.5 and Debian v0.4.7. The best approach is to use the generic Linux binaries provided on Julia's download page, at

Please follow the instructions corresponding to your Linux distribution, as indicated at


Docker is a software technology that provides an additional layer of abstraction of operating-system-level virtualization. In plain English, Docker sets up containers that behave like VMs, but without the added overhead of starting and maintaining VMs. You can run Docker on all the major operating systems. 

Docker is widely used as a development and deployment strategy, so many technologies are readily available in the form of Docker images, and Julia is no exception.

Start by installing Docker for your platform. The official Julia container can be found in the Docker store at Go get it.


If you need help setting up Docker or installing containers, follow the instructions at

At the command prompt, type $ docker pull julia. Once the Julia image is configured by Docker, run it with $ docker exec -it --rm julia. This will start the container and load a new Julia REPL:


Julia Computing, the company behind the Julia programming language, offers a batteries included distribution. It's called JuliaPro and it's arguably the easiest way to get started with Julia straight away. It includes the compiler, a profiler, the Juno IDE, and over 160 top quality curated packages for plotting, data visualization, machine learning, databases, and more.

JuliaPro can be downloaded for free at (registration required). Once you get it, follow the install process specific to your platform. When done you'll have everything needed to begin using Julia productively.


A paid enterprise version is also available, offering a few extra features, such as Excel integration and support with SLA.


Finally, there's also JuliaBox (, another free offering from Julia Computing. JuliaBox allows running a Julia Docker container on the fly, in their cloud. It provides access to IJulia Jupyter notebooks (, file sync with Google Drive, importing GitHub repositories, and many other features.


If you are not familiar with Jupyter notebooks, you can learn more about them by visiting