aiplan4eu / unified-planning

The AIPlan4EU Unified Planning Library
Apache License 2.0
199 stars 42 forks source link

Exception UPNoRequestedEngineAvailableException issue #549

Open ndenicoo opened 11 months ago

ndenicoo commented 11 months ago

User Story

Im trying the library in Jupyter Notebook. I tried to solve the following simple problem.

from unified_planning.shortcuts import *

x = Fluent("x")

a = InstantaneousAction("a")
a.add_precondition(Not(x))
a.add_effect(x, True)

problem = Problem("basic")
problem.add_fluent(x)
problem.add_action(a)
problem.set_initial_value(x, False)
problem.add_goal(x)

with OneshotPlanner(name='pyperplan') as planner:
    result = planner.solve(problem)
    if result.status == up.engines.PlanGenerationResultStatus.SOLVED_SATISFICING:
        print("Pyperplan returned: %s" % result.plan)
    else:
        print("No plan found.")

However, I get the following error

File ~\anaconda3\Lib\site-packages\unified_planning\engines\factory.py:504, in Factory._get_engine_class(self, operation_mode, name, problem_kind, optimality_guarantee, compilation_kind, plan_kind, anytime_guarantee)
    502         return self._engines[name]
    503     else:
--> 504         raise up.exceptions.UPNoRequestedEngineAvailableException
    505 problem_features = list(problem_kind.features)
    506 planners_features = []

UPNoRequestedEngineAvailableException: 

Previously I installed

pip install unified_planning[pyperplan]

and the following text appeared: Requirement already satisfied: unified_planning[pyperplan] in c:\users\nicor\anaconda3\lib\site-packages (1.0.0) Requirement already satisfied: pyparsing in c:\users\nicor\anaconda3\lib\site-packages (from unified_planning[pyperplan]) (3.0.9) Requirement already satisfied: networkx in c:\users\nicor\anaconda3\lib\site-packages (from unified_planning[pyperplan]) (3.1) Requirement already satisfied: up-pyperplan==1.0.0 in c:\users\nicor\anaconda3\lib\site-packages (from unified_planning[pyperplan]) (1.0.0) Requirement already satisfied: pyperplan==2.1 in c:\users\nicor\anaconda3\lib\site-packages (from up-pyperplan==1.0.0->unified_planning[pyperplan]) (2.1) Requirement already satisfied: wheel in c:\users\nicor\anaconda3\lib\site-packages (from pyperplan==2.1->up-pyperplan==1.0.0->unified_planning[pyperplan]) (0.38.4)

alvalentini commented 11 months ago

Hi @ndenicoo! Are you sure you installed unified_planning[pyperplan] in the same python environment where you are running the notebook?

APhanSpAARC commented 1 week ago

Im having the same issue. However when trying to install unified-planning with the pyperplan extra i'm getting the following error.

unified_planning[pyperplan]
zsh: no matches found: unified_planning[pyperplan]

Im able to install unified_planning without issue, however its just including the pyperlan extra solver that seems to be an issue.

APhanSpAARC commented 1 week ago

So the issue was zsh shell is interpreting the square brackets as a pattern matching operator when using the command below (from the aiplan4eu docs):

pip install unified-planning[pyperplan]

To fix this, i had to quote the whole package name like this:

pip install 'unified-planning[pyperplan]'