FiftyOne DB
FiftyOne DB is the underlying database backend component for the FiftyOne computer vision framework, storing metadata about datasets and samples. It primarily relies on MongoDB. The current PyPI version is 1.4.1. While `fiftyone-db` is a specific PyPI package, it acts as an internal dependency for the main `fiftyone` library, which has a rapid release cadence (e.g., currently at `1.14.x`). Users typically interact with the database layer through the `fiftyone` package itself.
Common errors
-
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused
cause FiftyOne's internal MongoDB service is not running or is inaccessible, often due to MongoDB not being installed, started, or having port conflicts.fixEnsure MongoDB is installed and running. If using a custom MongoDB, verify the `FIFTYONE_DATABASE_URI` environment variable or `database_uri` in your FiftyOne config is correct. Check for other processes using port 27017 (default MongoDB port). -
ModuleNotFoundError: No module named 'psutil'
cause The `psutil` package, a dependency of FiftyOne, might be missing or not correctly installed in the environment. This is common in some Linux setups or when virtual environments are not fully activated.fixInstall `psutil` in your active virtual environment: `pip install psutil`. On Debian-based Linux, `python3-dev` might also be needed: `sudo apt install python3-dev`. -
fiftyone.core.exceptions.DatasetNotFoundError: Dataset 'my-dataset' not found
cause Attempting to load a dataset that does not exist or has been deleted (e.g., if it was non-persistent and the Python session exited).fixVerify the dataset name using `fo.list_datasets()`. If the dataset was non-persistent, re-import it from its source files. If it was meant to be persistent, ensure it was saved with `dataset.persistent = True`. -
UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
cause IPython is installed globally but FiftyOne is in a virtual environment, leading to potential module resolution issues.fixInstall IPython directly into your active virtual environment: `pip install ipython`.
Warnings
- breaking `fiftyone-db` (and thus `fiftyone`) requires a running MongoDB instance. Failure to install or properly configure MongoDB will prevent the library from functioning, often resulting in connection errors on import.
- gotcha When working with `fiftyone` (which uses `fiftyone-db`), new versions occasionally introduce data model changes that require database migrations. While upgrades are often automatic, downgrades require manual migration using `fiftyone migrate --all -v <VERSION>` before installing the older version.
- gotcha By default, datasets in FiftyOne are non-persistent and are deleted from the database when all Python sessions importing FiftyOne exit. Explicitly persist datasets if you need them to be available across sessions.
- gotcha On some Unix systems, the default open file limit may be too small for FiftyOne's MongoDB connection, causing the database service to exit.
- deprecated FiftyOne is designed for MongoDB v6.0 or later. Support for older MongoDB versions (e.g., 5.0, 4.4) has ended or is ending soon. Compatibility with Python 3.9 might also end after June 1, 2026.
Install
-
pip install fiftyone-db
Imports
- db
import fiftyone_db
import fiftyone.db
Quickstart
import fiftyone as fo
import fiftyone.zoo as foz
# A quickstart for the main FiftyOne library, which implicitly uses fiftyone-db
dataset = foz.load_zoo_dataset("quickstart")
session = fo.launch_app(dataset)
session.wait() # Blocks execution until the App is closed if run in a script