facebookresearch / hydra

Hydra is a framework for elegantly configuring complex applications
https://hydra.cc
MIT License
8.83k stars 637 forks source link

[Bug] optuna depending on deprecated feature in sqlalchemy. #2562

Open 24hours opened 1 year ago

24hours commented 1 year ago

Optuna has updated their version to 3.1.0 due to SqlAlchemy upgrade. https://github.com/optuna/optuna/pull/4304

If installing version ~3.0.0, the follow error will occur.

self = <optuna.storages._rdb.storage._VersionManager object at 0x7f815c5d60d0>
    def get_current_version(self) -> str:

        context = alembic.migration.MigrationContext.configure(self.engine.connect())
        version = context.get_current_revision()
>       assert version is not None
E       AssertionError

This is because SQLAlchemy has been updated to version 2.0 and the feature is deprecated. Hydra currently depending on version 3.0.0 will break due to the upgrade.

https://github.com/facebookresearch/hydra/blob/main/plugins/hydra_optuna_sweeper/setup.py#L32

Currently the work around is installing optuna==3.1.0.

leezx commented 1 year ago

or downgrade to the previous version by pip install sqlalchemy==1.4.46. This works for me.

Jasha10 commented 1 year ago

Related to PR https://github.com/facebookresearch/hydra/pull/2360