A PostgresML deployment consists of two different runtimes. The foundational runtime is a Python extension for Postgres (pgml-extension) that facilitates the machine learning lifecycle inside the database. Additionally, we provide a dashboard (pgml-dashboard) that can connect to your Postgres server and provide additional management functionality. It will also provide visibility into the models you build and data they use.
Install PostgreSQL with PL/Python¶
PostgresML leverages Python libraries for their machine learning capabilities. You'll need to make sure the PostgreSQL installation has PL/Python built in.
We recommend you use Postgres.app because it comes with PL/Python. Otherwise, you'll need to install PL/Python manually. Once you have Postgres.app running, you'll need to install the Python framework. Mac OS has multiple distributions of Python, namely one from Brew and one from the Python community (Python.org); Postgres.app and PL/Python depend on the community one. The following versions of Python and Postgres.app are compatible:
|PostgreSQL version||Python version||Download link|
|14||3.9||Python 3.9 64-bit|
|13||3.8||Python 3.8 64-bit|
Each Ubuntu/Debian distribution comes with its own version of PostgreSQL, the simplest way is to install it from Aptitude:
EnterpriseDB provides Windows builds of PostgreSQL available for download.
Install the extension¶
To use our Python package inside PostgreSQL, we need to install it into the global Python package space. Depending on which version of Python you installed in the previous step, use the corresponding pip executable.
--database-url option to point to your PostgreSQL server.
If everything works, you should be able to run this successfully:
Run the dashboard¶
The PostgresML dashboard is a Django app, that can be run against any PostgreSQL installation. There is an included Dockerfile if you wish to run it as a container, or you may want to setup a Python venv to isolate the dependencies. Basic install can be achieved with:
Clone the repo:
Run the server: