Installing a SWI-Prolog pack

For the predicates used for installing a Pack into SWI-Prolog local install see prolog_pack.pl – A package manager for Prolog.

To see the list of all available packs:

?- pack_list('').
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
p achelois@0.5.0            - Collection of tools to make writing scripts in Prolog easier.
p aleph@5                   - Aleph Inductive Logic Programming system
p amazon_api@0.0.3          - Interface to Amazon APIs
...
p xsd@0.2.0                 - XML Schema validation with Prolog
A xtools@0.0.2(0.0.2)       - Extended Tools for SWI-Prolog
p yaml@0.1                  - YAML parser

If you need to capture the list because it is to large to scroll back try:

?- pwd.
% c:/users/groot/documents/
true.

?- tell('.\packs.txt'),pack_list(''),told.

To see list of all installed Packs.

?- pack_list_installed.
Installed packages (66):

i bio_analytics@0.3         - Computational biology data analytics.
i bio_db@3.1                - Access, use and manage big, biological datasets.
i bio_db_repo@20.03.08      - Data package for bio_db.
...
i wgraph@0.6                - Weighted graphs, with plotting via Real
i xlibrary@0.0.2            - Extended Libraries for Prolog
i xtools@0.0.2              - Extended Tools for SWI-Prolog
true.

To search for a pack.
NB The resulting list will indicate if the pack is installed. (ref)

?- pack_search(cli).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
p clitable@1.0.8            - Pretty unicode tables for the CLI with Prolog
p consul_client@0.0.4       - Consul Client
p eggdrop@1.4.111           - Hook up to an existing IRC Client called an Eggdrop
p googleclient@0.5.2        - SWI-Prolog code for "Login with Google"
...
p stompl@0.1                - STOMP client
p swicli@2.0.0              - SWI-Prolog interface to C/C++/.NET/Mono/Objective-C
p web@0.1.1                 - Easy web client
true.

To install a pack

?- pack_install(chess_db).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
Install chess_db@0.3 from http://stoics.org.uk/~nicos/sware/packs/chess_db/chess_db-0.3.tgz Y/n? 
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% "chess_db-0.3.tgz" was downloaded 15 times
Package:                chess_db
Title:                  PGN and chess game databases.
Installed version:      0.3
Author:                 Nicos Angelopoulos <http://stoics.org.uk/~nicos>
Maintainer:             Nicos Angelopoulos <http://stoics.org.uk/~nicos>
Packager:               Nicos Angelopoulos <http://stoics.org.uk/~nicos>
Home page:              http://stoics.org.uk/~nicos/sware/chess_db
Download URL:           http://stoics.org.uk/~nicos/sware/packs/chess_db/chess_db-*.tgz
Install "chess_db-0.3.tgz" (415,114 bytes) Y/n? 
true.

Notes

  • ERROR: Cannot find MinGW and/or MSYS.

It is not uncommon to find packs designed for Unix. Often these packs will work on Windows with MSYS/MinGW installed.

Another option instead of installing MinGW is to use WSL. Basically create a local Linux install that sits in a Virtual Machine. Then install SWI-Prolog on Linux and run SWI-Prolog on Linux. See: Using WSL on Windows with SWI-Prolog and Wiki Discussion: Using WSL on Windows with SWI-Prolog

  • On Windows, packs are installed into the directory
C:\Users\<User>\AppData\Local\swi-prolog\pack

Packs are manually installed after SWI-Prolog is installed as seen using the commands from the earlier section.

Packages are optional during the install of SWI-Prolog and typically installed by default. In other words when you are installing SWI-Prolog (Windows, Linux, Mac, etc.) that is when a package is installed. I don’t know if you can install a package after SWI-Prolog is installed without reinstalling SWI-Prolog; I have always reinstalled SWI-Prolog to add/remove a package.

  • Not all of the available Packs are listed in the documentation.

  • When a pack is installed the path aliases is updated, e.g.

?- file_search_path(library, 'c:/users/groot/appdata/local/swi-prolog/pack/chess_db/prolog').
true ;
false.
1 Like