# First example for swiplserver from documentation doesn't work - please help

**URL:** <https://swi-prolog.discourse.group/t/first-example-for-swiplserver-from-documentation-doesnt-work-please-help/6609>\
**Category:** General\
**Created:** [June 5, 2023, 1:26pm UTC](https://swi-prolog.discourse.group/t/first-example-for-swiplserver-from-documentation-doesnt-work-please-help/6609 "2023-06-05T13:26:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FranzHoermann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/franzhoermann/32/5535_2.png) [@FranzHoermann](https://swi-prolog.discourse.group/u/FranzHoermann)\
**Post date:** [June 5, 2023, 1:26pm UTC](https://swi-prolog.discourse.group/t/first-example-for-swiplserver-from-documentation-doesnt-work-please-help/6609/1 "2023-06-05T13:26:36Z")

</div>

Dear everyone,  
I just installed swiplserver 1.0.2 using Python 3.10 (SWI Prolog 9.0.4, AMD 64 version) and then I tried the first example from the docu:

```prolog
from swiplserver import PrologMQI, PrologThread

with PrologMQI() as mqi:
    with mqi.create_thread() as prolog_thread:
        result = prolog_thread.query("atom(a)")
        print(result)

```

But instead the expected “True” response I get this error message:

```plaintext
Prolog: ERROR: -g mqi_start: catch/3: Unknown procedure: mqi_start/0
Traceback (most recent call last):
  File "D:/SWIProlog/swiplservertest.py", line 3, in <module>
    with PrologMQI() as mqi:
  File "D:\Python310\lib\site-packages\swiplserver\prologmqi.py", line 326, in __enter__
    self.start()
  File "D:\Python310\lib\site-packages\swiplserver\prologmqi.py", line 428, in start
    raise PrologLaunchError("no port found in stdout")
swiplserver.prologmqi.PrologLaunchError: no port found in stdout

```

mqi\_start in the Interpreter runs and gives the result true.

I’m a little perplexed, because I think I did everything as stated in the documentation.

Could you, please, give me some hint?  
Thx very much  
Franz

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [June 5, 2023, 1:48pm UTC](https://swi-prolog.discourse.group/t/first-example-for-swiplserver-from-documentation-doesnt-work-please-help/6609/2 "2023-06-05T13:48:48Z")

</div>

If `mqi_start/0` is undefined we are dealing with an incomplete system. MQI is in library(mqi) and should be auto-loadable. From the path names this looks like you are using Windows? Installed from [swi-prolog.org](http://swi-prolog.org)? My Windows VM is broken at the moment, so I can’t run a quick test. What happens if you run this in a Prolog console?

```
?- [library(mqi)].

```

If that works there is probably something wrong with the autoload index. You can fix that by starting `swipl-win.exe` with sufficient rights to write to the installation directories and type

```
?- make.
% Updating index for library ...

```

Should that fix things, please let us know because that means something is wrong with the distribution files.

---

<div class="post-metadata">

**Author:** ![FranzHoermann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/franzhoermann/32/5535_2.png) [@FranzHoermann](https://swi-prolog.discourse.group/u/FranzHoermann)\
**Post date:** [June 5, 2023, 1:56pm UTC](https://swi-prolog.discourse.group/t/first-example-for-swiplserver-from-documentation-doesnt-work-please-help/6609/3 "2023-06-05T13:56:32Z")

</div>

Thank you very much, I did as you told me and now it works:

After running make. the python shell gives me:

```plaintext
================== RESTART: D:\SWIProlog\swiplservertest.py ==================
True
>>> 

```

Thank you very much and  
I hope it helps you to fix the distribution files.  
😉

---

<div class="post-metadata">

**Author:** ![FranzHoermann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/franzhoermann/32/5535_2.png) [@FranzHoermann](https://swi-prolog.discourse.group/u/FranzHoermann)\
**Post date:** [June 5, 2023, 2:01pm UTC](https://swi-prolog.discourse.group/t/first-example-for-swiplserver-from-documentation-doesnt-work-please-help/6609/4 "2023-06-05T14:01:22Z")

</div>

And, finally, here the infos about my windows installation:

| Edition | Windows 10 Home |
| --- | --- |
| Version | 22H2 |
| Installiert am | ‎16.‎08.‎2020 |
| Betriebssystembuild | 19045.2965 |
| Leistung | Windows Feature Experience Pack 1000.19041.1000.0 |

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [June 5, 2023, 6:59pm UTC](https://swi-prolog.discourse.group/t/first-example-for-swiplserver-from-documentation-doesnt-work-please-help/6609/5 "2023-06-05T18:59:20Z")

</div>

Thanks. What actually matters here is not the Windows version, but which distribution you used. We have binaries for Windows on [swi-prolog.org](http://swi-prolog.org), but there are several other sites that provide SWI-Prolog installers for Windows, such as Portable Apps. In addition it can be built using MSYS2, Cygwin or WSL. I assume you are using the default installer from [swi-prolog.org](http://swi-prolog.org)?
