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

For the many technological marvels we see today to be realized, there are a couple of things that made it […]

Caching is the key word in this article today and we are going to not only understand what it is […]

What is Web Scraping? Before we move forward with this good agenda, let us take a helpful step and get […]

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.