How To Enable pgvector extension on PostgreSQL

We recently encountered an error “PG::FeatureNotSupported: ERROR: extension ‘vector’ is not available” during an upgrade of Chatwoot. This happened because PostgreSQL could not find the vector extension, which is part of the pgvector extension for handling vector embeddings and powering AI applications for things like semantic search.

In this post we will cover the installation of pgvector PostgreSQL extension on your server – Ubuntu , Debian and RHEL-based systems.

Installing pgvector PostgreSQL extension

Before any installation, it’s good to confirm if the extensions is not active. Switch to postgres user:

sudo su - postgres

Then connect to psql console

postgres@chats:~$ psql

Run the following select statements to check if the extension is enabled or not.

postgres=# SELECT * FROM pg_extension WHERE extname = 'vector';
 oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
-----+---------+----------+--------------+----------------+------------+-----------+--------------
(0 rows)

If you get empty rows from the execution, it simply means the extension is not available.

Confirm the version of PostgreSQL server installed on your system. In our case, this is version 16.

~# psql --version
psql (PostgreSQL) 16.8 (Ubuntu 16.8-0ubuntu0.24.04.1)

Now install the extension using package syntax postgresql-<postgresql-version>-pgvector

  • Installation on Debian / Ubuntu
sudo apt update
sudo apt install postgresql-16-pgvector
  • Installation on Fedora / Rocky / AlmaLinux
sudo dnf install postgresql16-pgvector
  • Installation on macOS:
brew install pgvector

Enable pgvector extension in PostgreSQL

After the installation of pgvector, enable it in your PostgreSQL database:

sudo su - postgres
psql
CREATE EXTENSION vector;

Check again if the extension shows:

postgres=# SELECT * FROM pg_extension WHERE extname = 'vector';
  oid  | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
-------+---------+----------+--------------+----------------+------------+-----------+--------------
 17654 | vector  |       10 |         2200 | t              | 0.6.0      |           |
(1 row)

If the output has a row with vector extension details, then it is enabled.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

As the world keeps changing, everyone will agree that one of the enablers of this rapid change has been technology. […]

In this age where digital data is driving economies, feeding businesses with insights, creating jobs for many, improving service delivery […]

In our previous article, we looked at Must-Read Books to Learn Java Programming where we explored some of the resources […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.