!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

314 Members
https://github.com/nix-community/poetry2nix59 Servers

Load older messages


SenderMessageTime
6 Nov 2023
@pareto-optimal-dev:matrix.orgpareto-optimal-devhttps://github.com/nix-community/poetry2nix/issues/122618:36:55
@matthewcroughan:defenestrate.itmatthewcroughanI'll put this on github, I wanted to give them the flake anyway 18:40:21
@pareto-optimal-dev:matrix.orgpareto-optimal-devAlso someone has built llama-index with Nix it seems using buildPythonApplication, not sure if it'll help or not: https://github.com/jpetrucciani/nix/blob/9c9bf04afc46fc440cbf0e87089d330d9339ef86/mods/python/ai/prompts.nix#L167 Sometimes I see runtime things they do I didn't think of related to my issue though.18:40:16
@matthewcroughan:defenestrate.itmatthewcroughanhttps://github.com/MatthewCroughan/privateGPT18:43:55
@matthewcroughan:defenestrate.itmatthewcroughanhere's the flake18:44:05
@matthewcroughan:defenestrate.itmatthewcroughanit is seemingly just one runtime issue away from running perfectly 18:44:19
@matthewcroughan:defenestrate.itmatthewcroughanjust that llama-index can't see tiktoken 18:45:02
@matthewcroughan:defenestrate.itmatthewcroughan nix develop github:matthewcroughan/privateGPT#foo 18:45:29
@matthewcroughan:defenestrate.itmatthewcroughan then python -m private_gpt 18:45:42
@matthewcroughan:defenestrate.itmatthewcroughan

full trace

❯ python -m private_gpt
Traceback (most recent call last):
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/utils.py", line 49, in tokenizer
    import tiktoken
ModuleNotFoundError: No module named 'tiktoken'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/matthew/git/privateGPT/private_gpt/__main__.py", line 5, in <module>
    from private_gpt.main import app
  File "/home/matthew/git/privateGPT/private_gpt/main.py", line 4, in <module>
    import llama_index
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/__init__.py", line 21, in <module>
    from llama_index.indices.common.struct_store.base import SQLDocumentContextBuilder
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/indices/__init__.py", line 4, in <module>
    from llama_index.indices.document_summary.base import DocumentSummaryIndex
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/indices/document_summary/__init__.py", line 4, in <module>
    from llama_index.indices.document_summary.base import (
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/indices/document_summary/base.py", line 14, in <module>
    from llama_index.indices.base import BaseIndex
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/indices/base.py", line 6, in <module>
    from llama_index.chat_engine.types import BaseChatEngine, ChatMode
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/chat_engine/__init__.py", line 1, in <module>
    from llama_index.chat_engine.condense_question import CondenseQuestionChatEngine
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/chat_engine/condense_question.py", line 6, in <module>
    from llama_index.chat_engine.types import (
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/chat_engine/types.py", line 11, in <module>
    from llama_index.memory import BaseMemory
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/memory/__init__.py", line 1, in <module>
    from llama_index.memory.chat_memory_buffer import ChatMemoryBuffer
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/memory/chat_memory_buffer.py", line 12, in <module>
    class ChatMemoryBuffer(BaseMemory):
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/memory/chat_memory_buffer.py", line 18, in ChatMemoryBuffer
    default_factory=cast(Callable[[], Any], GlobalsHelper().tokenizer),
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/3g04wving6mlz1vxmnaqxy1wfsyh8g50-python3.11-llama-index-0.8.47/lib/python3.11/site-packages/llama_index/utils.py", line 51, in tokenizer
    raise ImportError(tiktoken_import_err)
ImportError: `tiktoken` package not found, please run `pip install tiktoken`
18:45:57
@matthewcroughan:defenestrate.itmatthewcroughan here's how it does the import in utils.py 18:46:45
@matthewcroughan:defenestrate.itmatthewcroughan
    def tokenizer(self) -> Callable[[str], List]:
        """Get tokenizer."""
        if self._tokenizer is None:
            tiktoken_import_err = (
                "`tiktoken` package not found, please run `pip install tiktoken`"
            )
            try:
                import tiktoken
            except ImportError:
                raise ImportError(tiktoken_import_err)
            enc = tiktoken.get_encoding("gpt2")
            self._tokenizer = cast(Callable[[str], List], enc.encode)
            self._tokenizer = partial(self._tokenizer, allowed_special="all")
        return self._tokenizer  # type: ignore

18:46:48
@matthewcroughan:defenestrate.itmatthewcroughanseems reasonable 18:46:50
@pareto-optimal-dev:matrix.orgpareto-optimal-devSomeone is adding something to importscheck here, not sure if related.. but interesting: https://sourcegraph.com/github.com/ibis-project/ibis/-/blob/nix/ibis.nix?L5418:58:21
@k900:0upti.meK900 pythonImportsCheck just checks the modules can be imported after the install 19:00:02
@k900:0upti.meK900It doesn't actually affect what is installed19:00:12
@k900:0upti.meK900It's just a failsafe to make sure the package you've just built isn't completely broken19:00:23
@pareto-optimal-dev:matrix.orgpareto-optimal-devThanks for the clarification19:01:29
@pareto-optimal-dev:matrix.orgpareto-optimal-devSo they are just adding checks for each of the ibis backends19:01:42
@pareto-optimal-dev:matrix.orgpareto-optimal-devOh... I think this could be it, I'll have to try it when my build of your flake finishes. Adding python path to the resulting wrapper: https://sourcegraph.com/github.com/GTrunSec/dataflow2nix/-/blob/nix/prefect/packages/prefect.nix?L3919:01:57
@pareto-optimal-dev:matrix.orgpareto-optimal-dev Interesting. nix run github:MatthewCroughan/privateGPT puts me in a python shell. Cloning the repo and doing nix run .# gives error: unable to execute '/nix/store/0c71l30nmfcmks194m1a16vryi3pjr34-python3.11-private-gpt-0.1.0/bin/private-gpt': No such file or directory. 19:15:38
@matthewcroughan:defenestrate.itmatthewcroughanthat is odd 19:16:02
@matthewcroughan:defenestrate.itmatthewcroughan do --refresh on the nix run 19:16:52
@pareto-optimal-dev:matrix.orgpareto-optimal-devI get the error with both now19:17:24
@matthewcroughan:defenestrate.itmatthewcroughanI force pushed a change, you must have ran the cmd before that change 19:19:39
@matthewcroughan:defenestrate.itmatthewcroughanpreviously I used mkPoetryEnv and now I'm using mkPoetryApplication19:19:48
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @pareto-optimal-dev:matrix.org
Oh... I think this could be it, I'll have to try it when my build of your flake finishes. Adding python path to the resulting wrapper: https://sourcegraph.com/github.com/GTrunSec/dataflow2nix/-/blob/nix/prefect/packages/prefect.nix?L39
Yeah but why isn't mkPoetryApplication doing this
19:32:32
@matthewcroughan:defenestrate.itmatthewcroughaneven the mkPoetryEnv doesn't include tiktoken19:35:19
@matthewcroughan:defenestrate.itmatthewcroughan
ls result/lib/python3.11/site-packages/tiktoken-0.5.1.dist-info
license_files  METADATA  RECORD  WHEEL
19:35:50
@matthewcroughan:defenestrate.itmatthewcroughanit only has this in it 19:35:52

Show newer messages


Back to Room ListRoom Version: 6