diff --git a/documentation/docs/contributing/development.mdx b/documentation/docs/contributing/development.mdx index cf4e0d2c..b98a1701 100644 --- a/documentation/docs/contributing/development.mdx +++ b/documentation/docs/contributing/development.mdx @@ -14,7 +14,7 @@ If you're looking for a place to get started, check out the list of [Github Issu ## Local Server Installation ### Using Pip -#### 1. Install +#### 1. Khoj Installation ```mdx-code-block import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -60,9 +60,54 @@ pip install -e '.[dev]' ``` +#### 2. Postgres Installation & Setup +Khoj uses the `pgvector` package to store embeddings of your index in a Postgres database. To use this, you need to have Postgres installed. -#### 2. Run +```mdx-code-block + + +Install [Postgres.app](https://postgresapp.com/). This comes pre-installed with `pgvector` and relevant dependencies. + + + 1. Use the [recommended installer](https://www.postgresql.org/download/windows/). + 2. Follow instructions to [Install PgVector](https://github.com/pgvector/pgvector#windows) in case you need to manually install it. Windows support is experimental for pgvector currently, so we recommend using Docker. Refer to Windows Installation Notes below if there are errors. + + + From [official instructions](https://wiki.postgresql.org/wiki/Apt) + + + 1. Follow instructions to [Install Postgres](https://www.postgresql.org/download/) + 2. Follow instructions to [Install PgVector](https://github.com/pgvector/pgvector#installation) in case you need to manually install it. + + +``` + +##### Create the Khoj database + +Make sure to update your environment variables to match your Postgres configuration if you're using a different name. The default values should work for most people. When prompted for a password, you can use the default password `postgres`, or configure it to your preference. Make sure to set the environment variable `POSTGRES_PASSWORD` to the same value as the password you set here. + +```mdx-code-block + + + ```shell +createdb khoj -U postgres --password + ``` + + + ```shell +createdb -U postgres khoj --password + ``` + + + ```shell +sudo -u postgres createdb khoj --password + ``` + + +``` + +#### 3. Run 1. Start Khoj ```bash khoj -vv @@ -72,6 +117,37 @@ pip install -e '.[dev]' Note: Wait after configuration for khoj to Load ML model, generate embeddings and expose API to query notes, images, documents etc specified in config YAML +#### Windows Installation Notes +1. Command `khoj` Not Recognized + - Try reactivating the virtual environment and rerunning the `khoj` command. + - If it still doesn't work repeat the installation process. +2. Python Package Missing *Usually says import xxx not recognized* + - Use `pip install xxx` and try running the `khoj` command. +3. Command `createdb` Not Recognized + - make sure path to postgres binaries is included in environment variables. It usually looks something like + ``` + C:\Program Files\PostgreSQL\16\bin + ``` +4. Connection Refused on port xxxx + - Locate the `pg_hba.conf` file in the location where postgres was installed. + - Edit the file to have **trust** as the method for user postgres, local, and host connections. + - Below is an example: +``` +host all postgres 127.0.0.1/32 trust +# "local" is for Unix domain socket connections only +local all all trust +# IPv4 local connections: +host all all 127.0.0.1/32 trust +# IPv6 local connections: +host all all ::1/128 trust +``` +4. Errors with installing pgvector + - Reinstall Visual Studio 2022 Build Tools with: + 1. desktop development with c++ selected in workloads + 2. MSVC (C++ Build Tools), Windows 10/11 SDK, and C++/CLI support for build tools selected in individual components. + - Open the x64 Native Tools Command Prompt as an Administrator + - Follow the pgvector windows installation [instructions](https://github.com/pgvector/pgvector?tab=readme-ov-file#windows) in this command prompt. + ### Using Docker Make sure you install the latest version of [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/).