Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with Python 3.12 #522

Closed
lrq3000 opened this issue Oct 28, 2023 · 5 comments · Fixed by #690
Closed

Incompatible with Python 3.12 #522

lrq3000 opened this issue Oct 28, 2023 · 5 comments · Fixed by #690
Assignees
Labels
maintain Maintain code, documentation or project

Comments

@lrq3000
Copy link

lrq3000 commented Oct 28, 2023

Just to let you guys know that the pre-release/github version of khoj-assistant (hash 9677eae) is currently incompatible with Python 3.12 because of two issues:

  1. pyproject.toml requires pyyaml==6.0, which causes an AttributeError: cython_sources as described here. Updating the requirement to pyyaml>=6.0 or using Python 3.11 without changing this requirement fixes this issue.
  2. torch requirement does not yet offer builds for Python 3.12, the latest supported version is Python 3.11. This issue cannot be fixed currently (as of October 2023).

So there is nothing to do but wait, I am just reporting this issue in case others get the same error.

@lrq3000 lrq3000 closed this as completed Oct 28, 2023
@sabaimran
Copy link
Member

Thank you for reporting, @lrq3000 ! Updating pyyaml should be trivial, but torch might be trickier. We'll watch out for this.

@ststudio907
Copy link

I'm very new to python. Literally just got it to use khoj with obsidian. How do I update requirements, or downgrade to python 3.11?

@lrq3000
Copy link
Author

lrq3000 commented Nov 17, 2023

@ststudio907 As long as you can't see a "cp312" package here, pytorch is not available for py3.12 and hence py<=3.11 is required.

An easy way to get py3.11 or any othes version is to install a miniconda distribution with python 3.11, or if you already have it, create an environment under python 3.11.

@debanjum debanjum reopened this Apr 7, 2024
@debanjum
Copy link
Member

debanjum commented Apr 7, 2024

Thanks for the initial investigation @lrq3000. Khoj should support python 3.12 once PR #690 is merged. This got unblocked since Pytorch added support for python 3.12 in mainline version 2.2.2.

debanjum added a commit that referenced this issue Apr 7, 2024
- RapidOCR for indexing image PDFs doesn't currently support python 3.12.
  It's an optional dependency anyway, so only install it if python < 3.12
- Run unit tests with python version 3.12 as well

Resolves #522
@debanjum debanjum added the maintain Maintain code, documentation or project label Apr 7, 2024
@debanjum debanjum self-assigned this Apr 7, 2024
@lrq3000
Copy link
Author

lrq3000 commented Apr 7, 2024

That's great to hear, thank you for the heads up!

debanjum added a commit that referenced this issue Apr 8, 2024
### 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintain Maintain code, documentation or project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants