6 Nov 2023 |
matthewcroughan - nix.how | nix develop github:matthewcroughan/privateGPT#foo | 18:45:29 |
matthewcroughan - nix.how | then python -m private_gpt | 18:45:42 |
matthewcroughan - nix.how | 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 - nix.how | here's how it does the import in utils.py | 18:46:45 |
matthewcroughan - nix.how | 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 - nix.how | seems reasonable | 18:46:50 |
pareto-optimal-dev | Someone is adding something to importscheck here, not sure if related.. but interesting: https://sourcegraph.com/github.com/ibis-project/ibis/-/blob/nix/ibis.nix?L54 | 18:58:21 |
K900 | pythonImportsCheck just checks the modules can be imported after the install | 19:00:02 |
K900 | It doesn't actually affect what is installed | 19:00:12 |
K900 | It's just a failsafe to make sure the package you've just built isn't completely broken | 19:00:23 |
pareto-optimal-dev | Thanks for the clarification | 19:01:29 |
pareto-optimal-dev | So they are just adding checks for each of the ibis backends | 19:01:42 |
pareto-optimal-dev | 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 | 19:01:57 |
pareto-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 - nix.how | that is odd | 19:16:02 |
matthewcroughan - nix.how | do --refresh on the nix run | 19:16:52 |
pareto-optimal-dev | I get the error with both now | 19:17:24 |
matthewcroughan - nix.how | I force pushed a change, you must have ran the cmd before that change | 19:19:39 |
matthewcroughan - nix.how | previously I used mkPoetryEnv and now I'm using mkPoetryApplication | 19:19:48 |
matthewcroughan - nix.how | 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 - nix.how | even the mkPoetryEnv doesn't include tiktoken | 19:35:19 |
matthewcroughan - nix.how | ls result/lib/python3.11/site-packages/tiktoken-0.5.1.dist-info
license_files METADATA RECORD WHEEL
| 19:35:50 |
matthewcroughan - nix.how | it only has this in it | 19:35:52 |
matthewcroughan - nix.how | ah the install of tiktoken may not work.. | 19:36:09 |
matthewcroughan - nix.how | It definitely compiled, but maybe outPath has wrong stuff in it | 19:36:32 |
matthewcroughan - nix.how | python3.11-tiktoken> installPhase ()
python3.11-tiktoken> {
python3.11-tiktoken> runHook preInstall;
python3.11-tiktoken> if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then
python3.11-tiktoken> echo "no Makefile or custom installPhase, doing nothing";
python3.11-tiktoken> runHook postInstall;
python3.11-tiktoken> return;
python3.11-tiktoken> else
python3.11-tiktoken> foundMakefile=1;
python3.11-tiktoken> fi;
python3.11-tiktoken> if [ -n "$prefix" ]; then
python3.11-tiktoken> mkdir -p "$prefix";
python3.11-tiktoken> fi;
python3.11-tiktoken> local flagsArray=(${enableParallelInstalling:+-j${NIX_BUILD_CORES}} SHELL=$SHELL);
python3.11-tiktoken> _accumFlagsArray makeFlags makeFlagsArray installFlags installFlagsArray;
python3.11-tiktoken> if [ -n "$__structuredAttrs" ]; then
python3.11-tiktoken> flagsArray+=("${installTargets[@]:-install}");
python3.11-tiktoken> else
python3.11-tiktoken> flagsArray+=(${installTargets:-install});
python3.11-tiktoken> fi;
python3.11-tiktoken> echoCmd 'install flags' "${flagsArray[@]}";
python3.11-tiktoken> make ${makefile:+-f $makefile} "${flagsArray[@]}";
python3.11-tiktoken> unset flagsArray;
python3.11-tiktoken> runHook postInstall
python3.11-tiktoken> }
| 19:37:35 |
matthewcroughan - nix.how | this is the installPhase for it | 19:37:38 |
matthewcroughan - nix.how | also
python3.11-tiktoken> ⚠ Warning: `build-backend` in pyproject.toml is not set to `maturin`, packaging tools such as pip will not use maturin to build this project.
| 19:38:02 |
matthewcroughan - nix.how | I included the maturin hook when it was not necessary | 19:39:41 |
matthewcroughan - nix.how | this lead to the failure, only included dist-info in the site-packages | 19:40:04 |