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

private-gpt: init at 0.5.0 #305586

Merged
merged 2 commits into from
May 12, 2024
Merged

private-gpt: init at 0.5.0 #305586

merged 2 commits into from
May 12, 2024

Conversation

drupol
Copy link
Contributor

@drupol drupol commented Apr 20, 2024

Should fix: #232681

Status: working.

Working example with a local Ollama service (nix run nixpkgs#ollama -- serve):

  1. Create the file settings.yaml from https://github.com/zylon-ai/private-gpt/blob/main/settings.yaml
  2. Create the file settings-local.yaml from https://github.com/zylon-ai/private-gpt/blob/main/settings-local.yaml
  3. Tweak the settings-local.yaml as such:
server:
  env_name: "local"

data:
  local_data_folder: /tmp/local_data/private_gpt

llm:
  mode: ollama
  tokenizer: ""

embedding:
  mode: ollama

ollama:
  llm_model: llama3
  embedding_model: nomic-embed-text
  api_base: http://localhost:11434
  embedding_api_base: http://localhost:11434

vectorstore:
  database: qdrant

qdrant:
  path: /tmp/local_data/private_gpt/qdrant
  1. Run private-gpt as such:
PGPT_PROFILES=local PGPT_SETTINGS_FOLDER=. ./result/bin/private-gpt

An issue has been opened upstream to fix the tests: zylon-ai/private-gpt#1870

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Apr 20, 2024
@drupol drupol mentioned this pull request Apr 20, 2024
13 tasks
@drupol drupol force-pushed the private-gpt/init branch 2 times, most recently from 00cf90d to 3c9c2f5 Compare April 20, 2024 17:07
@github-actions github-actions bot added 8.has: documentation This PR adds or changes documentation 8.has: changelog labels Apr 20, 2024
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 labels Apr 20, 2024
@drupol drupol force-pushed the private-gpt/init branch from 3c9c2f5 to ab753bc Compare April 20, 2024 17:35
@drupol drupol force-pushed the private-gpt/init branch 3 times, most recently from a596c98 to ccbcfc2 Compare April 23, 2024 19:13
@drupol drupol force-pushed the private-gpt/init branch 3 times, most recently from eb7409d to 3894039 Compare April 24, 2024 13:21
@drupol drupol force-pushed the private-gpt/init branch 2 times, most recently from 89de83a to ae978e5 Compare April 28, 2024 10:10
@drupol drupol marked this pull request as ready for review May 4, 2024 19:57
@drupol drupol force-pushed the private-gpt/init branch 5 times, most recently from 3ea2d9d to d4b0e24 Compare May 8, 2024 18:37
@drupol drupol force-pushed the private-gpt/init branch from d4b0e24 to 1d6afbe Compare May 9, 2024 06:32
Copy link
Contributor

@Kreyren Kreyren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Consider chmod 660 for the config file for reasons mentioned
  • Fix typo
  • Consider requesting upstream to release new version so that we don't have to patch security vulnerabiliy prior to merge

Reviewed the code, didn't find any problems beyond mentioned, LGTM

Package itself was not tested as i am not familiar with the service.

@drupol drupol force-pushed the private-gpt/init branch 2 times, most recently from cf9a8a1 to 3b1bded Compare May 9, 2024 13:55
@drupol drupol marked this pull request as draft May 10, 2024 06:44
Copy link
Contributor

@Kreyren Kreyren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Did not test the software for reasons mentioned
  • CI doesn't return any blocking issues
  • Submitter sufficiently addressed highlighted problems
  • I don't see any issues

LGTM

@drupol drupol force-pushed the private-gpt/init branch from 3b1bded to aff1950 Compare May 11, 2024 20:42
@drupol drupol marked this pull request as ready for review May 12, 2024 10:53
@drupol drupol merged commit 8949291 into NixOS:master May 12, 2024
25 checks passed
@drupol drupol deleted the private-gpt/init branch May 12, 2024 10:53
@davidsierradz
Copy link
Contributor

Hi! Couldn't make it work, with services.private-gpt.enable = true; and ollama server running (ollama version is 0.1.41), I'm getting the following error:

systemctl status private-gpt.service
private-gpt[3636]: 14:36:29.565 [INFO    ] private_gpt.settings.settings_loader - Starting application with profiles=['default', 'local']
private-gpt[3636]: Error in cpuinfo: failed to parse processor information from /proc/cpuinfo
private-gpt[3636]: 14:36:33.268 [INFO    ] private_gpt.components.llm.llm_component - Initializing the LLM in mode=ollama
private-gpt[3636]: 14:36:34.133 [INFO    ] private_gpt.components.embedding.embedding_component - Initializing the embedding model in mode=ollama
private-gpt[3636]: Traceback (most recent call last):
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
private-gpt[3636]:     return self._context[key]
private-gpt[3636]:            ~~~~~~~~~~~~~^^^^^
private-gpt[3636]: KeyError: <class 'private_gpt.ui.ui.PrivateGptUi'>
private-gpt[3636]: During handling of the above exception, another exception occurred:
private-gpt[3636]: Traceback (most recent call last):
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
private-gpt[3636]:     return self._context[key]
private-gpt[3636]:            ~~~~~~~~~~~~~^^^^^
private-gpt[3636]: KeyError: <class 'private_gpt.server.ingest.ingest_service.IngestService'>
private-gpt[3636]: During handling of the above exception, another exception occurred:
private-gpt[3636]: Traceback (most recent call last):
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
private-gpt[3636]:     return self._context[key]
private-gpt[3636]:            ~~~~~~~~~~~~~^^^^^
private-gpt[3636]: KeyError: <class 'private_gpt.components.embedding.embedding_component.EmbeddingComponent'>
private-gpt[3636]: During handling of the above exception, another exception occurred:
private-gpt[3636]: Traceback (most recent call last):
private-gpt[3636]:   File "/nix/store/vhqp00qxbbaq22aja41m8bgrlzjwfcak-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/components/embedding/embedding_component.py", line 62, in __init__
private-gpt[3636]:     from llama_index.embeddings.ollama import (  # type: ignore
private-gpt[3636]: ModuleNotFoundError: No module named 'llama_index.embeddings.ollama'
private-gpt[3636]: The above exception was the direct cause of the following exception:
private-gpt[3636]: Traceback (most recent call last):
private-gpt[3636]:   File "<frozen runpy>", line 198, in _run_module_as_main
private-gpt[3636]:   File "<frozen runpy>", line 88, in _run_code
private-gpt[3636]:   File "/nix/store/vhqp00qxbbaq22aja41m8bgrlzjwfcak-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/__main__.py", line 5, in <module>
private-gpt[3636]:     from private_gpt.main import app
private-gpt[3636]:   File "/nix/store/vhqp00qxbbaq22aja41m8bgrlzjwfcak-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/main.py", line 6, in <module>
private-gpt[3636]:     app = create_app(global_injector)
private-gpt[3636]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/vhqp00qxbbaq22aja41m8bgrlzjwfcak-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/launcher.py", line 63, in create_app
private-gpt[3636]:     ui = root_injector.get(PrivateGptUi)
private-gpt[3636]:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
private-gpt[3636]:     return function(*args, **kwargs)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
private-gpt[3636]:     provider_instance = scope_instance.get(interface, binding.provider)
private-gpt[3636]:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
private-gpt[3636]:     return function(*args, **kwargs)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
private-gpt[3636]:     instance = self._get_instance(key, provider, self.injector)
private-gpt[3636]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
private-gpt[3636]:     return provider.get(injector)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
private-gpt[3636]:     return injector.create_object(self._cls)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
private-gpt[3636]:     self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1031, in call_with_injection
private-gpt[3636]:     dependencies = self.args_to_inject(
private-gpt[3636]:                    ^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
private-gpt[3636]:     return function(*args, **kwargs)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1079, in args_to_inject
private-gpt[3636]:     instance: Any = self.get(interface)
private-gpt[3636]:                     ^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
private-gpt[3636]:     return function(*args, **kwargs)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
private-gpt[3636]:     provider_instance = scope_instance.get(interface, binding.provider)
private-gpt[3636]:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
private-gpt[3636]:     return function(*args, **kwargs)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
private-gpt[3636]:     instance = self._get_instance(key, provider, self.injector)
private-gpt[3636]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
private-gpt[3636]:     return provider.get(injector)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
private-gpt[3636]:     return injector.create_object(self._cls)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
private-gpt[3636]:     self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1031, in call_with_injection
private-gpt[3636]:     dependencies = self.args_to_inject(
private-gpt[3636]:                    ^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
private-gpt[3636]:     return function(*args, **kwargs)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1079, in args_to_inject
private-gpt[3636]:     instance: Any = self.get(interface)
private-gpt[3636]:                     ^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
private-gpt[3636]:     return function(*args, **kwargs)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
private-gpt[3636]:     provider_instance = scope_instance.get(interface, binding.provider)
private-gpt[3636]:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
private-gpt[3636]:     return function(*args, **kwargs)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
private-gpt[3636]:     instance = self._get_instance(key, provider, self.injector)
private-gpt[3636]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
private-gpt[3636]:     return provider.get(injector)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
private-gpt[3636]:     return injector.create_object(self._cls)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
private-gpt[3636]:     self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
private-gpt[3636]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1040, in call_with_injection
private-gpt[3636]:     return callable(*full_args, **dependencies)
private-gpt[3636]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
private-gpt[3636]:   File "/nix/store/vhqp00qxbbaq22aja41m8bgrlzjwfcak-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/components/embedding/embedding_component.py", line 66, in __init__
private-gpt[3636]:     raise ImportError(
private-gpt[3636]: ImportError: Local dependencies not found, install with `poetry install --extras embeddings-ollama`
systemd[1]: private-gpt.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: private-gpt.service: Failed with result 'exit-code'.
systemd[1]: private-gpt.service: Consumed 5.480s CPU time, no IP traffic.

@drupol
Copy link
Contributor Author

drupol commented Jun 5, 2024

I will try to have a look at it next week. In the meantime, I switched to open-webui: #316248

@drupol
Copy link
Contributor Author

drupol commented Jun 7, 2024

I have the same issue now:

jun 07 10:24:04 x13 sudo[2780206]: pam_unix(sudo:session): session closed for user root
jun 07 10:24:10 x13 private-gpt[2780127]: 10:24:10.218 [INFO    ] private_gpt.components.llm.llm_component - Initializing the LLM in mode=ollama
jun 07 10:24:11 x13 private-gpt[2780127]: 10:24:11.228 [INFO    ] private_gpt.components.embedding.embedding_component - Initializing the embedding model in mode=ollama
jun 07 10:24:11 x13 private-gpt[2780127]: Traceback (most recent call last):
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     return self._context[key]
jun 07 10:24:11 x13 private-gpt[2780127]:            ~~~~~~~~~~~~~^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]: KeyError: <class 'private_gpt.ui.ui.PrivateGptUi'>
jun 07 10:24:11 x13 private-gpt[2780127]: During handling of the above exception, another exception occurred:
jun 07 10:24:11 x13 private-gpt[2780127]: Traceback (most recent call last):
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     return self._context[key]
jun 07 10:24:11 x13 private-gpt[2780127]:            ~~~~~~~~~~~~~^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]: KeyError: <class 'private_gpt.server.ingest.ingest_service.IngestService'>
jun 07 10:24:11 x13 private-gpt[2780127]: During handling of the above exception, another exception occurred:
jun 07 10:24:11 x13 private-gpt[2780127]: Traceback (most recent call last):
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     return self._context[key]
jun 07 10:24:11 x13 private-gpt[2780127]:            ~~~~~~~~~~~~~^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]: KeyError: <class 'private_gpt.components.embedding.embedding_component.EmbeddingComponent'>
jun 07 10:24:11 x13 private-gpt[2780127]: During handling of the above exception, another exception occurred:
jun 07 10:24:11 x13 private-gpt[2780127]: Traceback (most recent call last):
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/0brhcpidvcqh6s1ax3by3wdn8nzakjr7-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/components/embedding/embedding_component.py", line 62, in __init__
jun 07 10:24:11 x13 private-gpt[2780127]:     from llama_index.embeddings.ollama import (  # type: ignore
jun 07 10:24:11 x13 private-gpt[2780127]: ModuleNotFoundError: No module named 'llama_index.embeddings.ollama'
jun 07 10:24:11 x13 private-gpt[2780127]: The above exception was the direct cause of the following exception:
jun 07 10:24:11 x13 private-gpt[2780127]: Traceback (most recent call last):
jun 07 10:24:11 x13 private-gpt[2780127]:   File "<frozen runpy>", line 198, in _run_module_as_main
jun 07 10:24:11 x13 private-gpt[2780127]:   File "<frozen runpy>", line 88, in _run_code
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/0brhcpidvcqh6s1ax3by3wdn8nzakjr7-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/__main__.py", line 5, in <module>
jun 07 10:24:11 x13 private-gpt[2780127]:     from private_gpt.main import app
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/0brhcpidvcqh6s1ax3by3wdn8nzakjr7-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/main.py", line 6, in <module>
jun 07 10:24:11 x13 private-gpt[2780127]:     app = create_app(global_injector)
jun 07 10:24:11 x13 private-gpt[2780127]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/0brhcpidvcqh6s1ax3by3wdn8nzakjr7-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/launcher.py", line 63, in create_app
jun 07 10:24:11 x13 private-gpt[2780127]:     ui = root_injector.get(PrivateGptUi)
jun 07 10:24:11 x13 private-gpt[2780127]:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
jun 07 10:24:11 x13 private-gpt[2780127]:     return function(*args, **kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     provider_instance = scope_instance.get(interface, binding.provider)
jun 07 10:24:11 x13 private-gpt[2780127]:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
jun 07 10:24:11 x13 private-gpt[2780127]:     return function(*args, **kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     instance = self._get_instance(key, provider, self.injector)
jun 07 10:24:11 x13 private-gpt[2780127]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
jun 07 10:24:11 x13 private-gpt[2780127]:     return provider.get(injector)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     return injector.create_object(self._cls)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
jun 07 10:24:11 x13 private-gpt[2780127]:     self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1031, in call_with_injection
jun 07 10:24:11 x13 private-gpt[2780127]:     dependencies = self.args_to_inject(
jun 07 10:24:11 x13 private-gpt[2780127]:                    ^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
jun 07 10:24:11 x13 private-gpt[2780127]:     return function(*args, **kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1079, in args_to_inject
jun 07 10:24:11 x13 private-gpt[2780127]:     instance: Any = self.get(interface)
jun 07 10:24:11 x13 private-gpt[2780127]:                     ^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
jun 07 10:24:11 x13 private-gpt[2780127]:     return function(*args, **kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     provider_instance = scope_instance.get(interface, binding.provider)
jun 07 10:24:11 x13 private-gpt[2780127]:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
jun 07 10:24:11 x13 private-gpt[2780127]:     return function(*args, **kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     instance = self._get_instance(key, provider, self.injector)
jun 07 10:24:11 x13 private-gpt[2780127]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
jun 07 10:24:11 x13 private-gpt[2780127]:     return provider.get(injector)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     return injector.create_object(self._cls)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
jun 07 10:24:11 x13 private-gpt[2780127]:     self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1031, in call_with_injection
jun 07 10:24:11 x13 private-gpt[2780127]:     dependencies = self.args_to_inject(
jun 07 10:24:11 x13 private-gpt[2780127]:                    ^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
jun 07 10:24:11 x13 private-gpt[2780127]:     return function(*args, **kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1079, in args_to_inject
jun 07 10:24:11 x13 private-gpt[2780127]:     instance: Any = self.get(interface)
jun 07 10:24:11 x13 private-gpt[2780127]:                     ^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
jun 07 10:24:11 x13 private-gpt[2780127]:     return function(*args, **kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     provider_instance = scope_instance.get(interface, binding.provider)
jun 07 10:24:11 x13 private-gpt[2780127]:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
jun 07 10:24:11 x13 private-gpt[2780127]:     return function(*args, **kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     instance = self._get_instance(key, provider, self.injector)
jun 07 10:24:11 x13 private-gpt[2780127]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
jun 07 10:24:11 x13 private-gpt[2780127]:     return provider.get(injector)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
jun 07 10:24:11 x13 private-gpt[2780127]:     return injector.create_object(self._cls)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
jun 07 10:24:11 x13 private-gpt[2780127]:     self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/j1yamvi5g0x4wnm3p6jslg73nnpjll0v-python3.11-injector-0.21.0/lib/python3.11/site-packages/injector/__init__.py", line 1040, in call_with_injection
jun 07 10:24:11 x13 private-gpt[2780127]:     return callable(*full_args, **dependencies)
jun 07 10:24:11 x13 private-gpt[2780127]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jun 07 10:24:11 x13 private-gpt[2780127]:   File "/nix/store/0brhcpidvcqh6s1ax3by3wdn8nzakjr7-python3.11-private-gpt-0.5.0/lib/python3.11/site-packages/private_gpt/components/embedding/embedding_component.py", line 66, in __init__
jun 07 10:24:11 x13 private-gpt[2780127]:     raise ImportError(
jun 07 10:24:11 x13 private-gpt[2780127]: ImportError: Local dependencies not found, install with `poetry install --extras embeddings-ollama`
jun 07 10:24:12 x13 systemd[1]: private-gpt.service: Main process exited, code=exited, status=1/FAILURE
jun 07 10:24:12 x13 systemd[1]: private-gpt.service: Failed with result 'exit-code'.
jun 07 10:24:12 x13 systemd[1]: private-gpt.service: Consumed 6.553s CPU time, no IP traffic.

I've been testing plenty of things. I added llama-index-embeddings-ollama in: nativeBuildInputs, buildInputs, propagatedBuildInputs and dependencies... but it never get found by private-gpt.

Something must have changed, maybe @fabaff or @mweinelt can help here? Do you know if something has changed somewhere?

@mweinelt
Copy link
Member

mweinelt commented Jun 7, 2024

Nothing off the top of my head. Probably best to bisect.

@drupol
Copy link
Contributor Author

drupol commented Jun 7, 2024

Will do that.

@drupol
Copy link
Contributor Author

drupol commented Jun 7, 2024

Here it is: a03085b

❯ git bisect good
a03085b16eaefdbcafc7925ecc9ee558b15ce1c4 is the first bad commit
commit a03085b16eaefdbcafc7925ecc9ee558b15ce1c4
Author: Fabian Affolter <redacted>
Date:   Fri May 24 22:57:40 2024 +0200

    python311Packages.llama-index-embeddings-openai: 0.1.9 -> 0.1.10

 .../python-modules/llama-index-embeddings-openai/default.nix          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
~/

@SomeoneSerge
Copy link
Contributor

I've been testing plenty of things. I added llama-index-embeddings-ollama in: nativeBuildInputs, buildInputs, propagatedBuildInputs and dependencies... but it never get found by private-gpt.

Is the reference actually retained in the withPackages environment though? Does the import work in a REPL?

@drupol
Copy link
Contributor Author

drupol commented Jun 7, 2024

I'm not familiar with Python, so I can't really tell. At this point, I think the issue mostly comes from an issue in one of these python packages... but I can't tell which or why.

@SomeoneSerge
Copy link
Contributor

❯ nix-shell -I nixpkgs=flake:github:NixOS/nixpkgs/master '<nixpkgs>' -p 'python3.withPackages (ps: [ ps.private-gpt ])'
...
❯ python
Python 3.11.9 (main, Apr  2 2024, 08:25:04) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import llama_index.embeddings.ollama            
>>> llama_index.embeddings.ollama.OllamaEmbedding
<class 'llama_index.embeddings.ollama.base.OllamaEmbedding'>
>>>

There's no problem with "imports", dependencies, or propagatedBuildInputs in the environment with just private-gpt and its closure (which includes the something-or-other-openai from the git-blamed commit)

@h7x4 h7x4 added 8.has: module (new) This PR adds a module in `nixos/` 8.has: tests This PR has tests labels Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python 8.has: changelog 8.has: documentation This PR adds or changes documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 8.has: tests This PR has tests 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: privategpt
7 participants