Skip to content

Create a ROMI database to host, receive & serve plant scansLink

To follow this guide you should have a conda environment, see here. For the sake of clarity it will be called plantscans_db.


Since this is still under development, the packages are installed in "editable mode" with the -e option.


If you do not want the hassle of having to create environment & install python libraries, there is a pre-built docker image, with usage instructions here.

Install plantdb sourcesLink

Activate your plantscans_db environment!

conda activate plantscans_db

To create an active ROMI database, you have to install the plantdb package:

git clone && \
cd plantdb && \
git checkout dev && \
python3.7 -m pip install setuptools setuptools-scm && \
python3.7 -m pip install luigi pillow && \
python3.7 -m pip install flask flask-restful flask-cors && \
python3.7 -m pip install .

Initialize a ROMI databaseLink

The FSDB class from the plantdb module is used to manage a local file system for data storage. A database is any folder which contains a file named plantdb.

To create an empty database, just create a new folder, and an empty file named plantdb in it. For example:

mkdir /data/romi_db
touch /data/romi_db/plantdb

Then define its location in an environment variable ROMI_DB:

export ROMI_DB='/data/ROMI/DB'


To permanently set this directory as the location of the DB, add it to your ~/.bashrc file.

echo 'export ROMI_DB=/data/ROMI/DB' >> ~/.bashrc

Set database permissionsLink


The following lines might be deprecated by the use of the --user option for docker run in the convenience scripts.

Assuming the path to the database is /data/ROMI/DB, you should create a romi group with GID 2020 and set the permissions as follows:

export ROMI_DB=/data/ROMI/DB
sudo addgroup --gid 2020 romi  # Add a `romi` group with GID `2020`
sudo adduser ${USER} romi  # Add the current user to the `romi` group
sudo chown :2020 -R ${ROMI_DB}  # Set group ownership of the database directory to `romi`
sudo chmod g+s ${ROMI_DB}  # Ensure all future content in the folder will inherit group ownership

This was inspired by this Medium blog post.

Serve the REST APILink

Then you can start the REST API with romi_scanner_rest_api:


You should see something like:

n scans = 2
 * Serving Flask app "romi_scanner_rest_api" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on (Press CTRL+C to quit)

To access the REST API, open your favorite browser and use URLs to access:

You should see JSON formatted text.

Troubleshooting: When starting the REST API with romi_scanner_rest_api, if you get an error message about this executable not being found, it may be missing from the $PATH environment variable. Add it with:

export PATH=$PATH:"/home/$USER/.local/bin"


To permanently set this in your bash terminal, add it to your ~/.bashrc file.

echo 'export PATH=$PATH:/home/$USER/.local/bin' >> ~/.bashrc