W
Wasp-lang2mo ago
VS

Regarding ask-the-documents WSL2 solution to compile

Error: P3006 Migration 20230907154352_add_extension failed to apply cleanly to the shadow database. Error: ERROR: extension "vector" is not available DETAIL: Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory. HINT: The extension must first be installed on the system where PostgreSQL is running. 0: sql_schema_connector::validate_migrations with namespaces=None at schema-engine/connectors/sql-schema-connector/src/lib.rs:335 1: schema_core::state::DevDiagnostic at schema-engine/core/src/state.rs:276 Commands for people on wsl2 to compile the project First, access the PostgreSQL container: docker exec -it $(docker ps | grep postgres | awk '{print $1}') bash apt-get update apt-get install -y build-essential postgresql-server-dev-16 git git clone https://github.com/pgvector/pgvector.git cd pgvector make USE_PGXS=1 make install USE_PGXS=1 psql -U postgresWaspDevUser -d askTheDocuments-e44202d61c -c "CREATE EXTENSION IF NOT EXISTS vector;" exit wasp db migrate-dev
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @Adam. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, it seems like you're trying to use the vector extension with PostgreSQL in a Wasp project, but you're encountering an error because the extension isn't available. Here's a step-by-step guide on how to install the vector extension in your PostgreSQL database running in a Docker container: 1. Access the PostgreSQL container:
docker exec -it $(docker ps | grep postgres | awk '{print $1}') bash
docker exec -it $(docker ps | grep postgres | awk '{print $1}') bash
2. Update the package lists for upgrades and new package installations:
apt-get update
apt-get update
3. Install the necessary packages:
apt-get install -y build-essential postgresql-server-dev-16 git
apt-get install -y build-essential postgresql-server-dev-16 git
4. Clone the pgvector repository:
git clone <https://github.com/pgvector/pgvector.git>
git clone <https://github.com/pgvector/pgvector.git>
5. Navigate to the pgvector directory:
cd pgvector
cd pgvector
6. Build the extension:
make USE_PGXS=1
make USE_PGXS=1
7. Install the extension:
make install USE_PGXS=1
make install USE_PGXS=1
8. Create the vector extension in your database:
psql -U postgresWaspDevUser -d askTheDocuments-e44202d61c -c "CREATE EXTENSION IF NOT EXISTS vector;"
psql -U postgresWaspDevUser -d askTheDocuments-e44202d61c -c "CREATE EXTENSION IF NOT EXISTS vector;"
9. Exit the PostgreSQL container:
exit
exit
10. Run the Wasp database migration:
wasp db migrate-dev
wasp db migrate-dev
Please note that these instructions are based on the knowledge sources provided and may need to be adjusted based on your specific setup. For example, you may need to replace postgresWaspDevUser and askTheDocuments-e44202d61c with your actual PostgreSQL username and database name, respectively. Also, please be aware that the vector extension is not officially supported by Prisma, the database toolkit used by Wasp. As a result, you may need to use raw SQL queries to interact with vector data types in your database (source (https://github.com/wasp-lang/wasp/issues/1215)). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Adam, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
martinsos
martinsos2mo ago
Hey Adam, you took the ask-the-documents example app and are trying ot build it? It says pg extension vector is not available, you will have to ensure that the pg database you are using has that extension installed.
VS
VSOP2mo ago
Yes! Just wanted to write the instructions for others on wsl2!
Want results from more Discord servers?
Add your server