khoj-ai / khoj

Your AI second brain. Get answers to your questions, whether they be online or in your own notes. Use online AI models (e.g gpt4) or private, local LLMs (e.g llama3). Self-host locally or use our cloud instance. Access from Obsidian, Emacs, Desktop app, Web or Whatsapp.
https://khoj.dev
GNU Affero General Public License v3.0
12k stars 595 forks source link

Unnecessary dependencies are installed by `pip install khoj-assistant` #368

Open link2xt opened 11 months ago

link2xt commented 11 months ago

I do not even have an NVIDIA card, but various nvidia-cuda dependencies were installed. Would be nice to have these dependencies optional.

debanjum commented 11 months ago

Yeah, this is unnecessary and annoying. A khoj dependency pulls in nvidia-cuda dependencies but only on linux machines for some reason. What can be done to fix that needs to be investigated

lumpsoid commented 8 months ago

As I understand it, it is related to torch dependency, because if you use pip install torch, you will get a version of torch for a system with CUDA image

and to install torch without CUDA you should use pip3 install torch torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu.

I'm not very familiar with the hatch system, but perhaps something like this would work:

[tool.hatch.dependencies]
torch = { version = "*", index = "https://download.pytorch.org/whl/cpu" }
torchvision = "*"
torchaudio = "*"

EDIT: and the installation logs from pip indicate that Collecting nvidia-cuda-nvrtc-cu12==12.1.105 (from torch>=2.0.1->khoj-assistant)