ML-KULeuven / problog

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

Error on Linux Errno 8 OSError #23

Closed worl44 closed 5 years ago

worl44 commented 5 years ago

I try problog default, dt, lfi, and mpe on Linux Ubuntu 16.04 as well as on Linux Mint 19. Only mpe works for me on both OS. dt, lfi and default mode always produce the following error

Traceback (most recent call last): File "/home/usr/lib/python3.7/site-packages/problog/tasks/dtproblog.py", line 54, in main result = dtproblog(model, **vars(args)) File "/home/usr/lib/python3.7/site-packages/problog/tasks/dtproblog.py", line 117, in dtproblog knowledge = get_evaluatable(koption).create_from(gp) File "/home/usr/lib/python3.7/site-packages/problog/core.py", line 150, in create_from return ProbLog.convert(obj, cls, **kwdargs) File "/home/usr/lib/python3.7/site-packages/problog/core.py", line 120, in convert next_obj = path[0](current_obj, path[1](**kwdargs), **kwdargs) File "/home/usr/lib/python3.7/site-packages/problog/ddnnf_formula.py", line 289, in _compile_with_dsharp result = _compile(cnf, cmd, cnf_file, nnf_file) File "/home/usr/lib/python3.7/site-packages/problog/ddnnf_formula.py", line 337, in _compile subprocess_check_call(cmd, stdout=OUT_NULL) File "/home/usr/lib/python3.7/site-packages/problog/util.py", line 184, in subprocess_check_call retcode = subprocess_call(*popenargs, **kwargs) File "/home/usr/lib/python3.7/site-packages/problog/util.py", line 205, in subprocess_call process = subprocess.Popen(*popenargs, **kwargs) File "/home/usr/lib/python3.7/subprocess.py", line 769, in __init__ restore_signals, start_new_session) File "/home/usr/lib/python3.7/subprocess.py", line 1516, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: '/home/usr/lib/python3.7/site-packages/problog/bin/linux/dsharp'

On Windows all works fine within the anaconda environment, so i also try anaconda on the both Linux machines, same behavior.

VincentDerk commented 5 years ago

Can you confirm that /home/usr/lib/python3.7/site-packages/problog/bin/linux/dsharp exists and you are able to run it?

worl44 commented 5 years ago

Yes i can confirm dsharp exists in this path. But i have no idea how to run it. i try it with python and get the following error: File "dsharp", line 1 SyntaxError: Non-UTF-8 code starting with '\xed' in file dsharp on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

VincentDerk commented 5 years ago

I guess executing ./dsharp should be sufficient to know whether it can execute. It should print some usage information.

Edit: just to be clear, it is not a Python file. Open a terminal in that directory and type "./dsharp" without the " to execute it.

worl44 commented 5 years ago

No sorry. ./dsharp is not executable. binary file can not be executed: Wrong format.

VincentDerk commented 5 years ago

That explains the OSError. What is the output of

uname -a

and the output of

file ./dsharp

?

worl44 commented 5 years ago

uname -a: Linux worl44-VirtualBox 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:19 UTC 2019 i686 i686 i686 GNU/Linux

file ./dsharp:

./dsharp: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=cc61de9cec96edb9780d133e0601edc4293de033, not stripped

VincentDerk commented 5 years ago

I believe the issue is that the dsharp executable we provide is compiled for 64-bit while you have a 32-bit system. (Sources: stackoverflow/linux-is-32-bit-or-64-bit and ubuntuforums/t-1088759 ).

To solve this, you can either 1) use a 64-bit system. 2) compile the dSharp code into a 32-bit one (I believe this is the source code that was used). 3) Try a different knowledge compiler. For example, when you install PySDD (no windows support yet) ProbLog will use that instead of dSharp. It is however possible that you bump into the same issue there. I am not sure.

VincentDerk commented 5 years ago

For option 2: try replacing the dsharp file with the one in this zip: dsharp.zip

worl44 commented 5 years ago

Hi Vincent,

It works fine with the new dsharp. Thank you a lot for the help.

VincentDerk commented 5 years ago

Alright, great!