'MLFlow -> ModuleNotFoundError: No module named 'sqlalchemy.future'

It seems to use MLFlow Model Registry locally, one option is to build my own backend database with SQLite.

I've found a site, which advised to run:

mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./artifacts --host 0.0.0.0 --port 5000

When running the command above, I get the following error message:

2022/05/22 23:08:58 ERROR mlflow.cli: Error initializing backend store
2022/05/22 23:08:58 ERROR mlflow.cli: No module named 'sqlalchemy.future'
Traceback (most recent call last):
  File "/home/username/.local/lib/python3.8/site-packages/mlflow/cli.py", line 426, in server
    initialize_backend_stores(backend_store_uri, default_artifact_root)
  File "/home/username/.local/lib/python3.8/site-packages/mlflow/server/handlers.py", line 259, in initialize_backend_stores
    _get_tracking_store(backend_store_uri, default_artifact_root)
  File "/home/username/.local/lib/python3.8/site-packages/mlflow/server/handlers.py", line 244, in _get_tracking_store
    _tracking_store = _tracking_store_registry.get_store(store_uri, artifact_root)
  File "/home/username/.local/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/registry.py", line 39, in get_store
    return self._get_store_with_resolved_uri(resolved_store_uri, artifact_uri)
  File "/home/username/.local/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/registry.py", line 49, in _get_store_with_resolved_uri
    return builder(store_uri=resolved_store_uri, artifact_uri=artifact_uri)
  File "/home/username/.local/lib/python3.8/site-packages/mlflow/server/handlers.py", line 110, in _get_sqlalchemy_store
    from mlflow.store.tracking.sqlalchemy_store import SqlAlchemyStore
  File "/home/username/.local/lib/python3.8/site-packages/mlflow/store/tracking/sqlalchemy_store.py", line 11, in <module>
    from sqlalchemy.future import select
ModuleNotFoundError: No module named 'sqlalchemy.future'

This seems odd, because if I run pip freeze, the sqlalchemy shows up, or if I do from sqlalchemy.future import select in a notebook, I get no error.

I think this may related to using a virtual environment. The current one I'm using is in /home/username/folder/mlflow/.mlflow but mlflow seems to be looking elsewhere for the file...



Solution 1:[1]

I resolved the issue by downgrading to a lower version of mlflow, (from v1.26.0 to v1.23.1).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mosope