Karush Logo


How to install CLINGO on Windows

CLINGO is an answer set solver used to process declarative programs. Unlike an imperative language such as Python or C# where you program algorithms as a series of steps (changing program states), in a declarative programming language you instead describe the solution without describing the "how" of obtaining the solution. The answer set solver processes the program and outputs a "stable model" or "answer set" that meets the described solution.

Internet Resources for CLINGO

Source code on github


In version 5.4 and prior, the github maintainers provided a compiled executable that could be downloaded and used on Windows, however that is not the case for current versions.

CLINGO is really built to run on Linux. Our workflow will be to use the Windows Subsystem for Linux (WSL) to install and execute CLINGO, however we will use VS Code in Windows as our editor for the CLINGO program files on the WSL filesystem.


  1. Install WSL on Windows (it may already be installed)
    • Use powershell in Windows Terminal
    • Activate the Ubuntu distribution per the documentation
  2. Install Miniconda in Ubuntu (not Windows)
    • Start Ubuntu (Search bar -> type Ubuntu, or open a new tab in Terminal and change to Ubuntu)
    • Miniconda will be used to install/run CLINGO. Enter the following:
    mkdir -p ~/miniconda3
    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
    bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
    rm -rf ~/miniconda3/miniconda.sh
    ~/miniconda3/bin/conda init bash
    • Close and reopen Terminal
    • Type conda --version to confirm it's correctly installed
    • The text "(base)" in front of your command prompt indicates you are now in the conda environment.
    • conda deactivate will disable conda. conda activate will enable conda.
  3. Install CLINGO
    conda create -n potassco -c conda-forge clingo=5.6.2
    conda activate potassco
    • Type clingo --version to confirm it's correctly installed
    • Note that you will need to reissue the command conda activate potassco each time you restart Terminal

Creating CLINGO program (.lp files)

At this point you could use vim or nano in Ubuntu to create your CLINGO .lp files, however let's use VS Code.

  1. Install VS Code

  2. In Ubuntu create a working folder: mkdir clingo. You will put your programs (.lp files) here.

  3. Open this folder in VS Code (yes, open an Ubuntu folder using VS Code on Windows)

    • File -> Open Folder
    • Enter: \\wsl.localhost\Ubuntu\home\[your Ubuntu user name]\clingo
    • Click Yes in VS Code to allow host (and optionally check permanently allow host), if prompted
    • Click Yes in VS Code to "I trust the authors", if prompted
    • You now have VS Code (on Windows) editing files in a folder on Ubuntu
  4. In VS Code create a new file program1.lp

  5. Enter the following sample, and save the file.

    % instance
    guilty(harry).% encoding
    innocent(Suspect) :- motive(Suspect), not guilty(Suspect).
  6. In VS Code select Terminal -> New Terminal. Note that a Terminal window opens towards the bottom. The Terminal will likely default to "powershell". In the upper right of the Terminal window select the "+ v" (plus sign, down arrow) icon to change the Terminal to "Ubuntu (WSL)"

    • Enter conda activate potassco
    • Enter clingo program1.lp to run your CLINGO program
    • You will see the answer set and the word SATISFIABLE, indicating the program ran successfully
  7. (optional) In VS Code click on the Extensions icon on the left to install the "Answer Set Programming syntax highlighter" from "abelcour" to add syntax highlighting to your .lp code.


You have now established an environment and workflow for editing and running CLINGO programs. If you have any feedback feel free to contact me jimsvoboda@unomaha.edu