Skip to content

AssertionError thrown when creating study, but only on some machines #4392

@AHolliday

Description

@AHolliday

Expected behavior

When creating a new study with a sqlite database using optuna.create_study, the function call should succeed and a new study should be created.

Environment

  • Optuna version: 3.0.5
  • Python version: 3.8.15
  • OS: Linux-5.15.0-58-generic-x86_64-with-glibc2.10
  • (Optional) Other libraries and their versions:

Error messages, stack traces, or logs

>>> import optuna
>>> ss = optuna.create_study(study_name='foo', storage='sqlite:///foo.db')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/data/ahollid/mambaforge/envs/ptlearn/lib/python3.8/site-packages/optuna/_convert_positional_args.py", line 63, in converter_wrapper
    return func(**kwargs)
  File "/usr/local/data/ahollid/mambaforge/envs/ptlearn/lib/python3.8/site-packages/optuna/study/study.py", line 1147, in create_study
    storage = storages.get_storage(storage)
  File "/usr/local/data/ahollid/mambaforge/envs/ptlearn/lib/python3.8/site-packages/optuna/storages/__init__.py", line 32, in get_storage
    return _CachedStorage(RDBStorage(storage))
  File "/usr/local/data/ahollid/mambaforge/envs/ptlearn/lib/python3.8/site-packages/optuna/storages/_rdb/storage.py", line 225, in __init__
    self._version_manager.check_table_schema_compatibility()
  File "/usr/local/data/ahollid/mambaforge/envs/ptlearn/lib/python3.8/site-packages/optuna/storages/_rdb/storage.py", line 1134, in check_table_schema_compatibility
    current_version = self.get_current_version()
  File "/usr/local/data/ahollid/mambaforge/envs/ptlearn/lib/python3.8/site-packages/optuna/storages/_rdb/storage.py", line 1161, in get_current_version
    assert version is not None
AssertionError

Steps to reproduce

# python code
import optuna
ss = optuna.create_study(study_name='foo', storage='sqlite:///foo.db')

Additional context (optional)

This is something I've observed happen on two different machines now. Any time I try to create a study in a sqlite database by passing a url of the form `sqlite:///my_study_name.db', the above error is thrown, but only on certain machines where I've tried to run it, despite the fact that I'm running off the same conda environment with the same software versions in each case. On machines where it doesn't work, the two-line minimal example I gave is enough, but on other machines I can run the same code with no problem, so I can't really give instructions to reproduce the issue.

Activity

added
bugIssue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.
on Feb 6, 2023
changed the title [-]Unpredictable failures in [/-] [+]AssertionError thrown when creating study, but only on some machines[/+] on Feb 6, 2023
AHolliday

AHolliday commented on Feb 6, 2023

@AHolliday
Author

I found that downgrading SQLAlchemy from version 2.0.0 to version 1.4.46 resolves the issue, as suggested by #4294 (comment). Closing the issue, since I suppose this means it's an issue with SQLAlchemy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @AHolliday

        Issue actions

          AssertionError thrown when creating study, but only on some machines · Issue #4392 · optuna/optuna