Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'problog.program'; 'problog' is not a package #108

Closed
alfie-nsugh opened this issue Dec 12, 2023 · 1 comment

Comments

@alfie-nsugh
Copy link

I ran this code:

from problog.formula import LogicFormula, LogicDAG
from problog.logic import Term
from problog.ddnnf_formula import DDNNF
from problog.cnf_formula import CNF
p = PrologString("""
coin(c1). coin(c2).
0.4::heads(C); 0.6::tails(C) :- coin(C).
win :- heads(C).
evidence(heads(c1), false).
query(win).
""")

lf = LogicFormula.create_from(p)   # ground the program
dag = LogicDAG.create_from(lf)     # break cycles in the ground program
cnf = CNF.create_from(dag)         # convert to CNF
ddnnf = DDNNF.create_from(cnf)       # compile CNF to ddnnf

ddnnf.evaluate()

But I got this error:
Traceback (most recent call last):
File "/home/avi/thesis/problog.py", line 1, in
from problog.program import PrologString
File "/home/avi/thesis/problog.py", line 1, in
from problog.program import PrologString
ModuleNotFoundError: No module named 'problog.program'; 'problog' is not a package

After pip installing using: pip install problog

@rmanhaeve
Copy link
Contributor

Try renaming your python file, as the name might overlap with that of the Problog package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants