aiplan4eu / up-tamer

Integration of Tamer with the Unified Planning Library
Apache License 2.0
3 stars 0 forks source link

Tamer incompatible with UP v0.6? #52

Closed jrenoux closed 1 year ago

jrenoux commented 1 year ago

Hi,

I just updated the UP to 0.6, with Tamer installed, and the following code is now breaking:

import unified_planning as up
from unified_planning.shortcuts import *

type_family = UserType("type_family")

With the following error:

Traceback (most recent call last):
  File "<dir>test_v_6.py", line 4, in <module>
    type_family = UserType("type_family")
  File "<dir>/python3.10/site-packages/unified_planning/shortcuts.py", line 496, in UserType
    return get_environment().type_manager.UserType(name, father)
  File "<dir>/python3.10/site-packages/unified_planning/environment.py", line 159, in get_environment
    GLOBAL_ENVIRONMENT = Environment()
  File "<dir>/python3.10/site-packages/unified_planning/environment.py", line 45, in __init__
    self._factory = unified_planning.engines.Factory(self)
  File "<dir>/python3.10/site-packages/unified_planning/engines/factory.py", line 189, in __init__
    self._add_engine(name, module_name, class_name)
  File "<dir>/python3.10/site-packages/unified_planning/engines/factory.py", line 377, in _add_engine
    module = importlib.import_module(module_name)
  File "<dir>/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<dir>/python3.10/site-packages/up_tamer/engine.py", line 39, in <module>
    class TState(up.model.ROState):
AttributeError: module 'unified_planning.model' has no attribute 'ROState'. Did you mean: 'State'?

Reverting to UP 0.5 removes the problem.

alvalentini commented 1 year ago

Did you also upgrade up-tamer?

jrenoux commented 1 year ago

Yes, I am on up-tamer 0.3.1 from Pypi

alvalentini commented 1 year ago

You should install the engines trough the unified-planning:

pip install unified-planning[tamer]==0.6.0

jrenoux commented 1 year ago

Ok, turned out I was using the wrong syntax in Poetry to manage my packages as extras. Thanks for the help!