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.