protectai / llm-guard

The Security Toolkit for LLM Interactions
https://llm-guard.com/
MIT License
1.12k stars 140 forks source link

llm-guard package installation with poetry. #104

Open Jurik-001 opened 6 months ago

Jurik-001 commented 6 months ago

If i want to install the llm-guard i run always in following issue:

ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

You address that already in your docs, the problem with your solution is, i did not find a way to integrate it with poetry. Can you please fix it?

asofter commented 6 months ago

Hey @Jurik-001 , we are planning to migrate it to Poetry, but unfortunately, there is no ETA on that. Are you running from Mac M1 since we usually see this problem on ARM-based machines?

Jurik-001 commented 6 months ago

Yes thats correct i use an M1 device, i can also support on migrating to poetry, if you want @asofter

asofter commented 6 months ago

That would be great. I have only limited experience with Poetry (as a user but never created a project with it). Thank you!

Jurik-001 commented 6 months ago

okay, i am start working on it, i saw you also not configure black, is that right? @asofter

asofter commented 6 months ago

Thanks! We do but through pre-commit hooks: https://github.com/protectai/llm-guard/blob/main/.pre-commit-config.yaml#L12-L16

liadlevy-pando commented 6 months ago

I have this problem as well using pip on MacOs Apple M1 Max @asofter

Jurik-001 commented 6 months ago

yeah, i worked yesterday on the switch to poetry, but get trouble with xformers package, same issue if i want install the current guard package, needs some intervention their, whats actually wrong @liadlevy-pando

asofter commented 6 months ago

Do you think it's solved with the newer version of Pytorch? We can try testing using it. Or, I am actually planning to just rely on the ONNX Runtime to remove some dependencies

Jurik-001 commented 6 months ago

@asofter so i think the problem is xFormers, if i understand correct that library i based on CUDA (https://github.com/facebookresearch/xformers/issues/987), which clearly not work on mac m chips. In which context you use that lib?

asofter commented 6 months ago

Honestly, we used it somewhere but I don't think we do anymore. Removed the package. Please let me know if it fixed the problem.

jayita13 commented 5 months ago

I'm facing the same issue with Python 3.12.1 on Windows fails at xformers installation Any way to resolve it yet @asofter @Jurik-001

jayita13 commented 5 months ago

seems like Python 3.12 wasn't compatible I was able to run it with 3.10

CandiedCode commented 4 months ago

Now that python has standardized on several build improvements like PEP 517 and PEP 660, I'm curious what migrating to poetry specifically solves?

Hatch is a PyPA project that seems to support similar functionality as poetry.

rye the makers of ruff and uv, also have a ackage management solution for Python. Because of the monorepo support, it maybe an interesting choice, for managing llm-guard and llm-guard-api.

I use setuptools + pip-tools personally, as I find I have less IDE configuration issues versus using poetry + vscode together.

rahulsingh50 commented 1 month ago

Python 3.12.1 on Windows fails.Issue

from llm_guard import scan_output, scan_prompt ModuleNotFoundError: No module named 'llm_guard'