Book Image

Julia 1.0 Programming Cookbook

By : Bogumił Kamiński, Przemysław Szufel
Book Image

Julia 1.0 Programming Cookbook

By: Bogumił Kamiński, Przemysław Szufel

Overview of this book

Julia, with its dynamic nature and high-performance, provides comparatively minimal time for the development of computational models with easy-to-maintain computational code. This book will be your solution-based guide as it will take you through different programming aspects with Julia. Starting with the new features of Julia 1.0, each recipe addresses a specific problem, providing a solution and explaining how it works. You will work with the powerful Julia tools and data structures along with the most popular Julia packages. You will learn to create vectors, handle variables, and work with functions. You will be introduced to various recipes for numerical computing, distributed computing, and achieving high performance. You will see how to optimize data science programs with parallel computing and memory allocation. We will look into more advanced concepts such as metaprogramming and functional programming. Finally, you will learn how to tackle issues while working with databases and data processing, and will learn about on data science problems, data modeling, data analysis, data manipulation, parallel processing, and cloud computing with Julia. By the end of the book, you will have acquired the skills to work more effectively with your data
Table of Contents (18 chapters)
Title Page
Copyright and Credits
About Packt

Installing Julia from binaries

The goal of this recipe is to present how to install and configure the Julia environment with the development toolbox. We show basic installation instructions for Linux and Windows.

Getting ready

In this recipe, we present how to install and configure Julia on Windows and Linux.

All Linux examples in this book have been tested on Linux Ubuntu 18.04.1 LTS and Windows 10. All Linux Ubuntu commands have been run as the user ubuntu. Please note that users of other Linux distributions will need to update their scripts (for example, Linux distributions from the Red Hat family use yum instead of apt).

For Windows examples in this book, we use Windows 10 Professional.


In the GitHub repository for this recipe you will find the commands.txt file that contains the presented sequence of shell commands.



How to do it...

For most users, the recommended way to start with Julia is to use a binary version.

In this section, we present the following options:

  • Installing Julia on Linux Ubuntu
  • Installing Julia on Windows

Installing Julia on Linux Ubuntu

Installing the binary release is the easiest way to proceed with Julia on Linux. Here, we show how to install Julia on Ubuntu, although the steps will be very similar for other Linux distributions.

Before the installation and use of Julia, we recommend installing a standard set of build tools for the Linux platform. Although this is not required for running Julia itself, several Julia package installers assume that the standard build tools set is present on the operating system. Hence, run the following commands in bash:

$ sudo apt update
$ sudo apt -y install build-essential

In order to install Julia, simply download the binary archive from, uncompress it, and finally create a symbolic link named Julia. These steps are shown in the following three bash commands (we assume that these commands are run in the /home/ubuntu folder):

$ wget
$ tar xvfz julia-1.0.1-linux-x86_64.tar.gz
$ sudo ln -s /home/ubuntu/julia-1.0.1/bin/julia /usr/local/bin/julia

Please note that the last command creates a symbolic link to the Julia binaries. After this installation, it is sufficient to run the julia command in the OS shell to start working with Julia. 

Please note that on the Julia web page (, a newer version of the installer could be available. You can update the preceding script accordingly by simply updating the filename. Additionally, nightly build Julia versions are available on the preceding website. These versions are only recommended for testing new language features.

Installing Julia on Windows

The most convenient way to install Julia on Windows is by using the binary version installer available from the JuliaLang website.

The following steps are required to install Julia on a Windows system:

  1. Download theWindows Self-Extracting Archive (.exe)from It is recommended to select the 64-bit version.
  2. Run the downloaded*.exefile to unpack Julia. We recommend extracting Julia into a directory path that does not contain any spaces, for example,C:\Julia-1.0.1.
  3. After a successful installation, a Julia shortcut will be added to your start menu—at this point, you can select the shortcut to see whether Julia loads correctly.
  4. Addjulia.exeto your system path, as follows:
    1. Open Windows Explorer, right-click on theThis PC computer icon, and selectProperties.
    2. ClickAdvanced system settingsand go toEnvironment Variables....
    3. Select thePath variable and clickEdit....
    4. To the variable value,addC:\Julia-1.0.1\bin(in this instruction, we assume that Julia has been installed to C:\Julia-1.0.1). Please note that, depending on your Windows version, there is either one Path value per line or a semicolon ; is used to separate values in the Path list.
    5. Click OK to confirm. Now, Julia can be run anywhere from the console.

When adding julia.exe to your system path, please note that there are two variable groups on this screen, User variablesandSystem variables. We recommend using User variables. Please note that adding julia.exe to the system Path makes it possible for other tools, such as Juno, toautomatically locate Julia (Juno also allows for manual Julia path configuration—this can be found in the option marked Packages | Julia client | Settings).


For the most convenient workflow, we recommend installing the ConEmu terminal emulator for Windows users.  The steps to install ConEmu on your Windows system are as follows:

  1. Go to theConEmu website ( click theDownloadlink. SelectDownload ConEmu Stable Installer.
  2. Once you download the *.exe file, run it to install ConEmu. Select the 64-bit version in the installer; other settings can keep their default values.
  3. Once ConEmu is installed, a new link in the start menu and on the desktop will be created.
  4. During the first application run, ConEmu asks about color settings—just stay with the defaults. Run ConEmu, type julia, and press Enter, and you should see a Julia prompt.

There's more...

Those users who want to try Julia without the installation process should try JuliaBox.

JuliaBox is a ready-made pre-installed Julia environment accessible from the web browser. It is available at You can use this version to play with a preconfigured and installed version of the Julia environment. Julia is available in a web browser via the Jupyter Notebook environment. The website is free to use, though it does require registration. JuliaBox comes with a set of pre-configured popular Julia libraries and is therefore ready for immediate use. This is an ideal solution for people wanting to try out the language or for using Julia inside a classroom.

See also

Excellent documentation on how to install Julia on various systems can be found on the JuliaLang website: