Install SWI-Prolog development version on Ubuntu using PPA

While this uses the development version of the software as an example, the steps are almost identical for the stable version.

Locate install instructions

Using an Internet browser

  1. Navigate to SWI-Prolog home page: https://www.swi-prolog.org/

  2. Mouse over Download


    image

  3. Click SWI-Prolog
    This will take you to download page: SWI-Prolog downloads

  4. Click Development release
    This will take you to development download page: SWI-Prolog downloads

  5. In the first line click PPA


    This will take you to Installing from PPA (Ubuntu Personal Package Archive) page: Installing from PPA (Ubuntu Personal Package Archive) which details the steps using apt-get.

Install

From an Ubuntu BASH command line prompt

  1. $ sudo apt-get install software-properties-common
Click triangle to expand details
groot@WINDOWS-XYZ:~$ sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.96.24.32.12).
software-properties-common set to manually installed.
The following package was automatically installed and is no longer required:
  libjpeg9
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
  1. $ sudo apt-add-repository ppa:swi-prolog/devel
    Press Enter when asked.
details
groot@WINDOWS-XYZ:~$ sudo apt-add-repository ppa:swi-prolog/devel

 More info: https://launchpad.net/~swi-prolog/+archive/ubuntu/devel
Press [ENTER] to continue or Ctrl-c to cancel adding it.

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 https://dbeaver.io/debs/dbeaver-ce  InRelease
Hit:3 https://deb.nodesource.com/node_10.x bionic InRelease
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://ppa.launchpad.net/swi-prolog/devel/ubuntu bionic InRelease [15.4 kB]
Get:6 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Hit:8 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Get:9 http://ppa.launchpad.net/swi-prolog/devel/ubuntu bionic/main amd64 Packages [1520 B]
Get:10 http://ppa.launchpad.net/swi-prolog/devel/ubuntu bionic/main Translation-en [968 B]
Fetched 270 kB in 2s (121 kB/s)
Reading package lists... Done
  1. $ sudo apt-get update
details
groot@WINDOWS-XYZ:~$ sudo apt-get update
Hit:1 https://deb.nodesource.com/node_10.x bionic InRelease
Hit:2 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Hit:3 https://dbeaver.io/debs/dbeaver-ce  InRelease
Hit:4 http://ppa.launchpad.net/swi-prolog/devel/ubuntu bionic InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:7 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:8 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
  1. $ sudo apt-get install swi-prolog
    Enter Y for yes when prompted.
details
groot@WINDOWS-XYZ:~$ sudo apt-get install swi-prolog
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libjpeg9
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libarchive13 libbsd-dev libedit-dev libgmp-dev libgmpxx4ldbl libncurses5-dev libncursesw5-dev libossp-uuid16
  swi-prolog-nox swi-prolog-x
Suggested packages:
  lrzip gmp-doc libgmp10-doc libmpfr-dev ncurses-doc uuid swi-prolog-doc prolog-el
The following NEW packages will be installed:
  libarchive13 libbsd-dev libedit-dev libgmp-dev libgmpxx4ldbl libncurses5-dev libncursesw5-dev libossp-uuid16
  swi-prolog swi-prolog-nox swi-prolog-x
0 upgraded, 11 newly installed, 0 to remove and 54 not upgraded.
Need to get 7334 kB of archives.
After this operation, 37.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libarchive13 amd64 3.2.2-3.1ubuntu0.6 [288 kB]
Get:2 http://ppa.launchpad.net/swi-prolog/devel/ubuntu bionic/main amd64 swi-prolog-nox amd64 8.1.32-1-gbf30a1395-bionicppa2 [3923 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libbsd-dev amd64 0.8.7-1ubuntu0.1 [150 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libncurses5-dev amd64 6.1-1ubuntu1.18.04 [174 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libedit-dev amd64 3.1-20170329-1 [99.1 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgmpxx4ldbl amd64 2:6.1.2+dfsg-2 [8964 B]
Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgmp-dev amd64 2:6.1.2+dfsg-2 [316 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libncursesw5-dev amd64 6.1-1ubuntu1.18.04 [199 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libossp-uuid16 amd64 1.6.2-1.5build4 [29.0 kB]
Get:10 http://ppa.launchpad.net/swi-prolog/devel/ubuntu bionic/main amd64 swi-prolog-x amd64 8.1.32-1-gbf30a1395-bionicppa2 [2119 kB]
Get:11 http://ppa.launchpad.net/swi-prolog/devel/ubuntu bionic/main amd64 swi-prolog amd64 8.1.32-1-gbf30a1395-bionicppa2 [27.2 kB]
Fetched 7334 kB in 2s (3387 kB/s)
Selecting previously unselected package libarchive13:amd64.
(Reading database ... 76254 files and directories currently installed.)
Preparing to unpack .../00-libarchive13_3.2.2-3.1ubuntu0.6_amd64.deb ...
Unpacking libarchive13:amd64 (3.2.2-3.1ubuntu0.6) ...
Selecting previously unselected package libbsd-dev:amd64.
Preparing to unpack .../01-libbsd-dev_0.8.7-1ubuntu0.1_amd64.deb ...
Unpacking libbsd-dev:amd64 (0.8.7-1ubuntu0.1) ...
Selecting previously unselected package libncurses5-dev:amd64.
Preparing to unpack .../02-libncurses5-dev_6.1-1ubuntu1.18.04_amd64.deb ...
Unpacking libncurses5-dev:amd64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libedit-dev:amd64.
Preparing to unpack .../03-libedit-dev_3.1-20170329-1_amd64.deb ...
Unpacking libedit-dev:amd64 (3.1-20170329-1) ...
Selecting previously unselected package libgmpxx4ldbl:amd64.
Preparing to unpack .../04-libgmpxx4ldbl_2%3a6.1.2+dfsg-2_amd64.deb ...
Unpacking libgmpxx4ldbl:amd64 (2:6.1.2+dfsg-2) ...
Selecting previously unselected package libgmp-dev:amd64.
Preparing to unpack .../05-libgmp-dev_2%3a6.1.2+dfsg-2_amd64.deb ...
Unpacking libgmp-dev:amd64 (2:6.1.2+dfsg-2) ...
Selecting previously unselected package libncursesw5-dev:amd64.
Preparing to unpack .../06-libncursesw5-dev_6.1-1ubuntu1.18.04_amd64.deb ...
Unpacking libncursesw5-dev:amd64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libossp-uuid16:amd64.
Preparing to unpack .../07-libossp-uuid16_1.6.2-1.5build4_amd64.deb ...
Unpacking libossp-uuid16:amd64 (1.6.2-1.5build4) ...
Selecting previously unselected package swi-prolog-nox.
Preparing to unpack .../08-swi-prolog-nox_8.1.32-1-gbf30a1395-bionicppa2_amd64.deb ...
Unpacking swi-prolog-nox (8.1.32-1-gbf30a1395-bionicppa2) ...
Selecting previously unselected package swi-prolog-x.
Preparing to unpack .../09-swi-prolog-x_8.1.32-1-gbf30a1395-bionicppa2_amd64.deb ...
Unpacking swi-prolog-x (8.1.32-1-gbf30a1395-bionicppa2) ...
Selecting previously unselected package swi-prolog.
Preparing to unpack .../10-swi-prolog_8.1.32-1-gbf30a1395-bionicppa2_amd64.deb ...
Unpacking swi-prolog (8.1.32-1-gbf30a1395-bionicppa2) ...
Setting up libarchive13:amd64 (3.2.2-3.1ubuntu0.6) ...
Setting up libbsd-dev:amd64 (0.8.7-1ubuntu0.1) ...
Setting up libossp-uuid16:amd64 (1.6.2-1.5build4) ...
Setting up libncurses5-dev:amd64 (6.1-1ubuntu1.18.04) ...
Setting up libncursesw5-dev:amd64 (6.1-1ubuntu1.18.04) ...
Setting up libedit-dev:amd64 (3.1-20170329-1) ...
Setting up libgmpxx4ldbl:amd64 (2:6.1.2+dfsg-2) ...
Setting up libgmp-dev:amd64 (2:6.1.2+dfsg-2) ...
Setting up swi-prolog-nox (8.1.32-1-gbf30a1395-bionicppa2) ...
update-alternatives: using /usr/bin/swipl to provide /usr/bin/prolog (prolog) in auto mode
Setting up swi-prolog-x (8.1.32-1-gbf30a1395-bionicppa2) ...
Setting up swi-prolog (8.1.32-1-gbf30a1395-bionicppa2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

Installing on Ubuntu needs Universe checked

Just a little note about a potential issue while installing SWI Prolog on Ubuntu’s Focal Fossa distribution, version 20.04. You might find that your distribution encounters a similar problem.

The PPA install may fail with error:

➜  ~ sudo apt install swi-prolog                 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 swi-prolog : Depends: swi-prolog-nox (= 8.3.18-2-g2727ce355-focalppa2) but it is not going to be installed
              Depends: swi-prolog-x (= 8.3.18-2-g2727ce355-focalppa2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

And after that, you can try to install without X11.

➜  ~ sudo apt install swi-prolog-nox
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 swi-prolog-nox : Depends: libossp-uuid16 but it is not installable
E: Unable to correct problems, you have held broken packages.

Still no joy, but note that the APT tool cannot find package libossp-uuid16. It turns out that you may have community-maintained (universe) package sources unchecked. It needs to be checked, as follows.


Installation now succeeds.

Start

To start SWI-Prolog use swipl.

groot@WINDOWS-XYZ:~$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.32)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?-

There are also older stable PPA versions

2 Likes