Among this spectrum of programming languages, one recently received mentions are Julia. Although more than a decade older, many still consider Julia new. It was developed in 2010 by Stefan Karpinski, Jeff Bezanson, and Viral B. Shah. Julia is an advanced, high-performance, dynamic programming language that is designed for technical computing. It comes with syntax that is well-known to people who use other computing environments.
It has a highly efficient compiler that supports distributed parallel execution, precision in numerical computation, and an enormous mathematical library. The library, which is mostly developed by hand in Julia itself, incorporates the most advanced, top-of-the-line C as well as Fortran library libraries that support linear algebra as well as random number generation FFTs along with string processing. Julia programs are structured around the definition of functions and overloaded with different types of arguments (which can be defined by the user).
As a dynamic programming language, Julia offers its services for various computational science and numerical analysis fields, such as machine learning, data science, scientific research, app-building, and visualization. Not only that, but Julia can work with other programming languages as well, such as Python, C, C++, Rust, R, and SQL.
Let’s understand more about Julia and install it on Ubuntu 22.04 Linux.
What Feature Does Julia Offer?
Julia offers the following features:
- A high-performing language and its developers set its high performance as an objective for it. The (LLVM) computer backend feature allows developers to efficiently compile Julia programs for various platforms from the native code.
- Dynamically typed, which provides its users with an interactive feel while they operate on it.
- The open-source project has more than 1000 contributors associated with it. This is why the MIT license provides coverage to Julia’s source code, available on GitHub.
- Pre-built binaries with which users can recreate a pre-existing Julia environment with ease.
- With multiple dispatch paradigms, you can easily express functional and object-oriented programming patterns.
Installing Julia on Ubuntu 22.04
Julia developers provide source code as well as pre-compiled binaries. We are going to download the pre-compiled libraries and install Julia to make it easy. You can go ahead and explore compiling it from the source code as well.
1. Download Julia
Just open firefox and head on to https://julialang.org/downloads/. Select Generic Linux on x86, either 64-bit or 32 bit depending on the configuration of your system. You can also download it using wget command from the terminal.
$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.2-linux-x86_64.tar.gz
The above command uses wget to download the pre-compiled Julia binary from its official page.
2. Extract the Julia TAR file
Extract the Julia Tar file using tar command.
$ tar zxvf julia-1.8.2-linux-x86_64.tar.gz
This completes the installation of Julia. These are pre-compiled libraries.
All the files required for Julia to work properly are copied into the julia-1.8.2 directory.
3. Add Julia to your PATH
Next, add Julia’s bin directory to the PATH environment variable, else you will get the below error when you type julia on the command prompt.
Command ‘julia’ not found, but can be installed with:
sudo snap install julia
So let’s go ahead and update .bashrc file.
$ nano ~/.bashrc
Add the bin directory at the end of the file. Save and exit.
$ export PATH="$PATH:/home/imaginelinux/julia-1.8.2/bin"
Moreover, if you want to make this change effective, you must source your .bashrc file using the following
$ source ~/.bashrc
After typing this, your Ubuntu system will find Julia to be executable.
4. Running Julia
Now, simply type julia on the command prompt.
You should get the below response.
You can run a basic sum or difference operation on the command prompt to see if it is working.
julia> 2 + 2 4
After you are satisfied with this experimentation, you can exit this session by typing Ctrl+D
Julia is widely used in data sciences and application-building processes as a programming language. This guide will teach you about the installation, testing, and basic usage of this platform language. However, you can visit the official website if you wish to learn more about this language.
You can easily remove julia from ubuntu by simply deleting the folder and removing the path entry from the .bashrc file.