Support using Python 3.12 with Khoj (#690)

### Why
- Python 3.12 is the default Python on Ubuntu 24.04 LTS, Windows and Mac via Homebrew
- Python 3.12 has a bunch of improvements that can be explored with Khoj (e.g per core GIL for performance)

## Changes
- The latest PyTorch now supports Python 3.12
- RapidOCR for indexing image PDFs doesn't currently support python 3.12.
  But it's an optional dependency, so only install it if python < 3.12

### Testing
- Verified Khoj installs fine on Windows and Mac with Python 3.12
- Verified Khoj chat works fine on Mac, Windows with Python 3.12

Resolves #522
This commit is contained in:
Debanjum 2024-04-08 11:43:34 +05:30 committed by GitHub
commit 4eda79cc3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 6 deletions

View file

@ -21,9 +21,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v1
with: { python-version: 3.9 }
with: { python-version: 3.11 }
- name: ⏬️ Install Dependencies
run: |
python -m pip install --upgrade pip

View file

@ -31,7 +31,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Python
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

View file

@ -32,6 +32,7 @@ jobs:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
services:
postgres:

View file

@ -30,6 +30,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
@ -47,12 +48,12 @@ dependencies = [
"tenacity >= 8.2.2",
"pillow ~= 9.5.0",
"pydantic >= 2.0.0",
"pyyaml == 6.0",
"pyyaml ~= 6.0",
"rich >= 13.3.1",
"schedule == 1.1.0",
"sentence-transformers == 2.5.1",
"transformers >= 4.28.0",
"torch == 2.0.1",
"torch == 2.2.2",
"uvicorn == 0.17.6",
"aiohttp ~= 3.9.0",
"langchain <= 0.2.0",
@ -70,7 +71,7 @@ dependencies = [
"gunicorn == 21.2.0",
"lxml == 4.9.3",
"tzdata == 2023.3",
"rapidocr-onnxruntime == 1.3.11",
"rapidocr-onnxruntime == 1.3.11; python_version<'3.12'",
"openai-whisper >= 20231117",
"django-phonenumber-field == 7.3.0",
"phonenumbers == 8.13.27",