# Using SWI-Prolog on Linux on a Windows machine

**URL:** <https://swi-prolog.discourse.group/t/using-swi-prolog-on-linux-on-a-windows-machine/3137>\
**Category:** Split Topic\
**Created:** [October 30, 2020, 8:36pm UTC](https://swi-prolog.discourse.group/t/using-swi-prolog-on-linux-on-a-windows-machine/3137 "2020-10-30T20:36:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 30, 2020, 8:36pm UTC](https://swi-prolog.discourse.group/t/using-swi-prolog-on-linux-on-a-windows-machine/3137/1 "2020-10-30T20:36:17Z")

</div>

> [@Need help installing library(real)](https://swi-prolog.discourse.group/t/need-help-installing-library-real/3134/3):
>
> Do you, or someone else, have a hint on what I can do without having to use “virtual box” or “dual boot” (too complex for me …).

1. Have you tried using [WSL](https://docs.microsoft.com/en-us/windows/wsl/about) 2?  
With WSL 2 you install a version of [Ubuntu](https://www.microsoft.com/en-us/p/ubuntu/9nblggh4msv6?activetab=pivot:overviewtab) and then install SWI-Prolog ([PPA](https://www.swi-prolog.org/build/PPA.html)) on top of that. I have done this many times and had no problems.

2. Currently I am learning how to build my own WSL Distro of SWI-Prolog. ([ref](https://swi-prolog.discourse.group/t/building-swi-prolog-on-ubuntu-20-04-from-source-how-sensitive-is-cmake-to-dcmake-install-prefix/3115))

3. Install Docker Desktop for Windows and use SWI-Prolog from [Docker Hub](https://hub.docker.com/_/swipl). Note this is currently at version `8.2.2` which is not the latest build of SWI-Prolog.

Note: For any of the three options above, if you want to use a SWI-Prolog GUI tool such as gtrace/0 then you will also need to install an X Windows server ([VcXsrv](https://sourceforge.net/projects/vcxsrv/)).

If you are a developer then take a look at also using [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab) and [Visual Studio Code](https://code.visualstudio.com/) with the [remote extensions](https://code.visualstudio.com/docs/remote/remote-overview).

HTH

---

<div class="post-metadata">

**Author:** ![JAB](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jab/32/2978_2.png) [@JAB](https://swi-prolog.discourse.group/u/JAB)\
**Post date:** [October 30, 2020, 10:40pm UTC](https://swi-prolog.discourse.group/t/using-swi-prolog-on-linux-on-a-windows-machine/3137/2 "2020-10-30T22:40:48Z")

</div>

Dear Eric  
You are right about wsl, but I have a desktop and a laptop running win10 and a whole set of data and tools. Swi+real (before 8.2) worked well with R and it would be a lot of work to move everything to wsl or Ubuntu.  
Swi 8.2 + real works well with R 4.03 on a fresh pc under win10.  
I can’t believe that an update over previously installed version doesn’t work.  
I just try to make it work on my laptop without buying a new one…

Please help  
Thank you in advance

Jab  
pja@a2m2.ch  
[mobile]

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 31, 2020, 10:54am UTC](https://swi-prolog.discourse.group/t/using-swi-prolog-on-linux-on-a-windows-machine/3137/3 "2020-10-31T10:54:39Z")

</div>

I have not tried this.

Instead of using WSL 2 with Ubuntu, you might be able to pull down a [Windows Image](https://hub.docker.com/_/microsoft-windows) from Docker Hub and build SWI-Prolog and R on top of that.

HTH

* * *

**EDIT**

You might have to use the [Windows image](https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/#container-images) with in a Windows container as opposed to a WSL 2 mode or Linux container in Hyper-V mode. ([ref](https://docs.docker.com/docker-for-windows/#resources)).

In other words, if you try to run a Windows image on an Ubuntu base machine it would fail, but with a Windows image on a Windows machine, the Windows image is using the license of Windows on the base machine and so allowed.

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [October 31, 2020, 11:13am UTC](https://swi-prolog.discourse.group/t/using-swi-prolog-on-linux-on-a-windows-machine/3137/4 "2020-10-31T11:13:50Z")

</div>

I can confirm that Real under Windows is no joy (tried it about 1 year ago), so I ended up with the “linux” swipl under WSL2, plus R support from package rserve\_client.
