With the release of PostgresML 2.0, this documentation has been deprecated. New installation instructions are available.

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 because it comes with PL/Python. Otherwise, you'll need to install PL/Python manually. Once you have 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 (; and PL/Python depend on the community one. The following versions of Python and are compatible:

PostgreSQL version Python version Download link
14 3.9 Python 3.9 64-bit
13 3.8 Python 3.8 64-bit

All installers for Mac OS are available here. You can also get more details about this in the documentation.


Each Ubuntu/Debian distribution comes with its own version of PostgreSQL, the simplest way is to install it from Aptitude:

content_copy link edit
$ sudo apt-get install -y postgresql-plpython3-12 python3 python3-pip postgresql-12


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.

Change the --database-url option to point to your PostgreSQL server.

content_copy link edit
sudo pip3 install pgml-extension
python3 -m pgml_extension --database-url=postgres://user_name:password@localhost:5432/database_name

If everything works, you should be able to run this successfully:

content_copy link edit
psql -c 'SELECT pgml.version()' postgres://user_name:password@localhost:5432/database_name

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:

  1. Clone the repo:
content_copy link edit
git clone && cd postgresml/pgml-dashboard
  1. Set your PGML_DATABASE_URL environment variable:
content_copy link edit
echo PGML_DATABASE_URL=postgres://user_name:password@localhost:5432/database_name > .env
  1. Install dependencies:
content_copy link edit
pip install -r requirements.txt
  1. Run the server:
content_copy link edit
python runserver

Have Questions?

Join our Discord and ask us anything! We're friendly and would love to talk about PostgresML.

Try It Out

Try PostresML using our free serverless cloud. It comes with GPUs, 5 GiB of space and plenty of datasets to get you started.

Powered by PostgresML Logo PostgresML