2.5 C

Install Spack on Ubuntu 20.04

Senior Writer and partner

Hello, friends. In this post, you will learn how to install Spack on Ubuntu 20.04. In case you don’t know what Sack is, we’ll tell you about it here too.

According to the official website of Spack,

Spack is a package manager for supercomputers, Linux, and macOS. It makes installing scientific software easy. Spack isn’t tied to a particular language; you can build a software stack in Python or R, link to libraries written in C, C++, or Fortran, and easily swap compilers or target specific microarchitectures.

This makes it a tool for a very specific sector but also for users who need a similar tool. With Spack, you can build a package with multiple versions, configurations, platforms, and compilers, and all of these builds can coexist on the same machine.

For such a professional tool, it’s very easy to install on Ubuntu 20.04

Install Spack on Ubuntu 20.04

Before you start, update all the operating system packages by running the following commands in the terminal:

sudo apt update
sudo apt upgrade

After that, install git and the Ubuntu package building tools.

sudo apt install git build-essential

Once the installation is finished, it’s time to install Spack.

To do this, you can use git and specify a directory where you want to save the archive.

git clone https://github.com/spack/spack ~/.apps/spack/Spack

In my case, I have chosen ~/.apps/spack/Spack but you can choose another path.

Now, to use Spack from any location at the prompt, you have to add this folder to the PATH.

echo '. ~/.apps/spack/Spack/Spack/share/spack/setup-env.sh' >> ~/.bash_profile

Then, apply the changes by running

source ~/.bash_profile

And we can start using it, for example, it shows the installed version:

spack -V

Using Spack on Ubuntu 20.04

The tool is quite simple to use, to install a program you just need to run

spack install [program_name]

Also, you can install the specific version of a program with the help of the @ sign.

spack install [program_name]@version

Now to know the version list of a program, you can use versions

spack versions [program_name]

If you want to know which packages or programs are available, you can do so with the list command

spack list

You can even filter them using a wildcard

spack list 'py-*'

In this case, all packages starting with py- will be shown.

To uninstall packages we can use the same syntax as install but with the uninstall command

spack uninstall [program_name]

Or for a specific version:

spack uninstall [program_name]@version

Also, it is useful to remove its dependencies with the -R option.

spack uninstall -R [program_name]

So, enjoy it.


Thanks to this post, you now know how to install Spack on Ubuntu 20.04 which is a tool used at a scientific level. It is quite easy to use and to install for all it does.

- Advertisement -


Please enter your comment!
Please enter your name here

Donate to Osradar

Latest article