I have “successfully installed janus_swi-1.4.0”. I started Python 3.11.1 and typed “import janus_swi as janus”. There was a “FATAL ERROR”, “Could not find system resources”. I have installed SWI-Prolog 64 bits Version 9.2.6.
From googling I have the impression that the problem is incompatible versions. If so, on 28 August 2024, which version of SWI-Prolog works with which version of Janus with which version of Python?
Probably that is not the problem. Not being able to find the system resources is related to the embedded Prolog system trying to find the location where it is installed. That is a pretty system dependent procedure, so which OS are we talking about and how did you install SWI-Prolog?
One way to force it is to set the environment variable SWI_HOME_DIR
to point at the directory where the system is installed, i.e., in which the file boot.prc
resides. That is the file it is looking for. This is not the preferred way to find this directory as it leads to troubles if you have multiple copies installed.
Many thanks. I installed the self-installing binary from SWI-Prolog downloads. I have now found what the problem was - I had added SWI_HOME_DIR as a user variable instead of a system variable. I have corrected this and the connection works. I expect this is good enough for me but what is the preferred way?
User and system variables smells like Windows? Normally, all should work fine if you add the directory holding swipl.exe
and libswipl.dll
(and a lot more) to %PATH%
.
Slightly related: On some systems, one might also need to set PYTHONHOME to the python installation so that janus finds it.