ML-KULeuven / problog

ProbLog is a Probabilistic Logic Programming Language for logic programs with probabilities.
https://dtai.cs.kuleuven.be/problog/
298 stars 34 forks source link

Add a Dockerfile for easier distribution #30

Closed savente93 closed 2 years ago

savente93 commented 4 years ago

I have had some problem with installing ProbLog for Python such that it could use the PySDD package in the past, especially without root. I've decided to make a Docker image that can use ProbLog with PySDD to make it easier to use in different places, which I thought might be useful for others. This pull request adds the following files:

Hopefully, people will find this useful

XVilka commented 4 years ago

Idea is good, but it's better to avoid the inclusion of these 3rd party sources. Moreover, I would opt for multistage docker build based on the Alpine image, so the resulting image would be way smaller.

savente93 commented 4 years ago

In principle, I agree, however, the whole point of the Docker image (for me at least) is to be able to use ProbLog with the PySDD package since the other parts of the library have some memory leaks that make it unusable for me. Since there is no automatic way to download the necessary C code (the UCLA page requires you to input information about yourself before it will let you download the code) needed to make it work, I had to include them in the PR.

As regards to the Alpine image, that was my first thought too, however I was unable to get this to work. When I tried to convert this Dockerfile into the alpine image, the installation just wasn't recognised and it didn't give any indication of what was wrong. Since I don't have time to dig into the PySDD code to find the problem I figured using the full python image was better than nothing.

cmungall commented 4 years ago

I would love to see a Dockerfile for problog. Small is nice, but I have had issues with Alpine in the past.

Including all external sources in this repo doesn't seem to make much sense though. If these cannot be downloaded e.g via wget then perhaps make a separate repo for these?

savente93 commented 4 years ago

I split the docker file into multiple stages so the c lib files could be included at the right stage, so now the dockerfile is the only thing in the PR. Regarding the use of Alpine, this is not possible for this project as is. That is because, as far as I understand, the SDD library requires certain debug symbols for compilation that aren't included in the Alpine image and I do not know enough about the library or C compilation to fix that. For the time being this at least works without adding extra resources to the repo which seemed to be people's main concern.