Skip to content

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

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

Closed
AHolliday opened this issue Feb 6, 2023 · 1 comment
Closed
Labels
bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.

Comments

@AHolliday
Copy link

AHolliday commented Feb 6, 2023

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.

@AHolliday AHolliday added the bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself. label Feb 6, 2023
@AHolliday AHolliday changed the title Unpredictable failures in AssertionError thrown when creating study, but only on some machines Feb 6, 2023
@AHolliday
Copy link
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
Labels
bug Issue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.
Projects
None yet
Development

No branches or pull requests

1 participant