Installing Trill on SWISH
redskate opened this issue · 12 comments
First of all my compliments for all that good work.
I am an RDF enthusiast which (was) quite good in prolog and now I would like to (re)start using prolog and some "intelligent" meta-inference engine to do interesting things.
Here my first problem: I am using docker-swish on a mac OSX (and use the same on a Linux prod machine). I would like to install trill on SWISH and I am using the explanation in https://github.com/rzese/trill to install it inside prolog.
- Execute
docker run -it swish
to start prolog on site to change configs. - as the description says,
pack_install(trill).
to install it.
Something starts but it breaks with an error:
Warning: 2019-10-19 12:42:41.880 make_directory/1: No permission to create directory `'/root/lib'' (Permission denied)
ERROR: 2019-10-19 12:42:41.881 Cannot find a place to create a package directory.Considered:
ERROR: 2019-10-19 12:42:41.881 /root/lib/swipl/pack
I need here to say that /root/lib exists and has the same rights as the process starting 1)
So I am stuck here - what should I do in order to stably install trill on swish on "my" instance of swish? Thanks a lot in advance!!!
Thanks a lot, Riccardo
For the sake of completeness I add here another post (regarding SWI prolog on installing trill) I issued some minutes ago:
There, trying to install trill throws others exceptions (I guess because the prolog installation might be there "incomplete" for OSX mojave [or in general] ?)
After a couple of tests, I think that the problem is in the configuration of the swish image, and not internal to TRILL.
In fact, if I try to install other packages I get the same error. On the other hand, if I run the image with the command --bash (docker run swish --bash
), I can install TRILL (and in general packages with the command pack_install
), their files are saved in /usr/lib/swipl/pack
. However, when I quit docker these changes are removed from the image. Moreover, this behaviour is different than what I get when I run pack_install
in the console obtained with the command docker run -it swish
. In fact, in this case, it tries to install the package into /root/lib/swipl/pack
, returning the permission error.
I would also like to add that to make TRILL work on swish, you should modify the swish.pl
file to make swish load TRILL, as you can see here swipl.pl @ friguzzi/trill-on-swish, that is the reason that led me to implement trill-on-swish as a fork of the original swish.
I also forget one important thing: TRILL can be tested online at http://trill-sw.eu, whose code can be found in the repository linked in my previous comment (https://github.com/friguzzi/trill-on-swish).
TRILL can be used at http://trill-sw.eu (indeed+thanks). This does not help installing it on an own SWISH platform ;)
However I do think you are right, as I tried to document, the OSX basic swipl installation as well as the docker SWISH installation do have some peculiarities which prevents TRILL to install.
I will try to follow your hint. Thank you!
In docker swipl - in the dir ./config-enabled there is no swish.pl but there one could put some files like in (https://github.com/friguzzi/trill-on-swish) to load. The only thing is that the order of loading cannot be influenced. Is this a possible solution or shell I redo (If I am allowed to) the docker swipl installation including your swish.pl (thank you) ?
Anyway inside the docker swish prolog interpreter env - it is not possible to use_module(library(trill)), since that prolog interpreter has no permission to run in sandboxed mode. So I am stuck.
Sorry, I wrongly read your previous message.
A couple of information about how swish works.
The file swish.pl is the main file that is used by run.pl to start swish.
In the folder ./config-enabled there are libraries used by swish to add functionalities such as login, direct connection to stackoverflow, better management of the log files, etc.
At the very beginning of the implementation of swish, due to some problems with modules, trill module had to be included from the file swish.pl. This is the motivation that forced me to modify swish.pl.
I have now tried to use the configuration method you suggested (using the config-enabled folder), which is indeed the correct way to add functionalities in swish.
If you add a .pl file, say c_trill.pl
in the config-enabled folder containing the following:
:- module(config_trill, []).
:- use_module(library(trill)).
swish will be able to correctly use trill.
Now, to have trill working on swish in a docker image, the image must contain trill and bddem packs in the /usr/lib/swipl/pack
folder.
To do so, you must run the image in interactive mode with
docker run -it --publish=3050:3050 -v /home/riccardo/src/docker-swish:/data swish
and execute the goals
pack_install(trill).
make.
or modify the configuration file c_trill.pl
in your config-enabled directory in this way:
:- module(config_trill, []).
:- pack_install(trill).
:- use_module(library(trill)).
After that, swish image can run trill. However, these operations must be done at every startup.
So, if you want to make these changes stable, you must rebuild the image by adding the following command in the Dockefile
after the last RUN
command:
RUN swipl -g "pack_install(trill,[interactive(False)])"
and use the first version of c_trill.pl
containing only the load of the library:
:- module(config_trill, []).
:- use_module(library(trill)).
Following these steps on my machine, swish can correctly run trill. I only get some error messages at the startup, that should disappear by running a second goal during image creation to rebuild the bddem module.
I confirm what said before regarding bddem library. So, to recap:
- re-build the image using the Dockerfile in the zip file in the attachment
- copy the file
c_trill.pl
in the folder config-enabled - run the image (I use the command
docker run -it --publish=3050:3050 -v /home/riccardo/src/docker-swish:/data swish
)
Trill will be loaded and working without any error message. The differences you will see with http://trill-sw.eu/ are:
- no TRILL examples in
Examples
menu - no TRILL logos.
Thank you Riccardo.
I did as you suggested.
Of course I am only interested in having a stable version of trill which starts every time I start docker-swish. Thank you for providing these instructions.
Using ./swish.pl the same data dir is mounted in the docker image.
Issuing the goal :-use_module(library(trill)).
delivers true - so I guess, trill is then mounted :)
THANK YOU Riccardo
You're welcome and thanks again for using TRILL.
For any other issues do not hesitate to ask.
I close this issue.