private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

ImportError: Local dependencies not found, install with `poetry install --extras llms-llama-cpp`

Open MYOUSUFFS opened this issue 10 months ago • 1 comments

Error Through

PGPT_PROFILES=local make run                                                           
poetry run python -m private_gpt
09:55:29.748 [INFO    ] private_gpt.settings.settings_loader - Starting application with profiles=['default', 'local']
09:55:52.967 [INFO    ] private_gpt.components.llm.llm_component - Initializing the LLM in mode=llamacpp
Traceback (most recent call last):
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
    return self._context[key]
           ~~~~~~~~~~~~~^^^^^
KeyError: <class 'private_gpt.ui.ui.PrivateGptUi'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
    return self._context[key]
           ~~~~~~~~~~~~~^^^^^
KeyError: <class 'private_gpt.server.ingest.ingest_service.IngestService'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 798, in get
    return self._context[key]
           ~~~~~~~~~~~~~^^^^^
KeyError: <class 'private_gpt.components.llm.llm_component.LLMComponent'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/MYSoft/own/ai/private-gpt/private_gpt/components/llm/llm_component.py", line 37, in __init__
    from llama_index.llms.llama_cpp import LlamaCPP  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'llama_index.llms'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/MYSoft/own/ai/private-gpt/private_gpt/__main__.py", line 5, in <module>
    from private_gpt.main import app
  File "/Users/MYSoft/own/ai/private-gpt/private_gpt/main.py", line 6, in <module>
    app = create_app(global_injector)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/own/ai/private-gpt/private_gpt/launcher.py", line 63, in create_app
    ui = root_injector.get(PrivateGptUi)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
    provider_instance = scope_instance.get(interface, binding.provider)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
    instance = self._get_instance(key, provider, self.injector)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
    return provider.get(injector)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
    return injector.create_object(self._cls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
    self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 1031, in call_with_injection
    dependencies = self.args_to_inject(
                   ^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 1079, in args_to_inject
    instance: Any = self.get(interface)
                    ^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
    provider_instance = scope_instance.get(interface, binding.provider)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
    instance = self._get_instance(key, provider, self.injector)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
    return provider.get(injector)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
    return injector.create_object(self._cls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
    self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 1031, in call_with_injection
    dependencies = self.args_to_inject(
                   ^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 1079, in args_to_inject
    instance: Any = self.get(interface)
                    ^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 974, in get
    provider_instance = scope_instance.get(interface, binding.provider)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 91, in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 800, in get
    instance = self._get_instance(key, provider, self.injector)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 811, in _get_instance
    return provider.get(injector)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 264, in get
    return injector.create_object(self._cls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 998, in create_object
    self.call_with_injection(init, self_=instance, kwargs=additional_kwargs)
  File "/Users/MYSoft/Library/Caches/pypoetry/virtualenvs/private-gpt-RG0SIui4-py3.11/lib/python3.11/site-packages/injector/__init__.py", line 1040, in call_with_injection
    return callable(*full_args, **dependencies)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MYSoft/own/ai/private-gpt/private_gpt/components/llm/llm_component.py", line 39, in __init__
    raise ImportError(
ImportError: Local dependencies not found, install with `poetry install --extras llms-llama-cpp`
make: *** [run] Error 1

ImportError

Local dependencies not found, install with poetry install --extras llms-llama-cpp

Try do install it but,

Run poetry install --extras llms-llama-cpp

Out-put

Installing dependencies from lock file

Package operations: 0 installs, 0 updates, 39 removals

  - Removing aiofiles (23.2.1)
  - Removing altair (5.2.0)
  - Removing contourpy (1.2.0)
  - Removing cycler (0.12.1)
  - Removing ffmpy (0.3.1)
  - Removing fonttools (4.46.0)
  - Removing gradio (4.19.2)
  - Removing gradio-client (0.10.1)
  - Removing grpcio (1.60.0)
  - Removing grpcio-tools (1.60.0)
  - Removing h2 (4.1.0)
  - Removing hpack (4.0.0)
  - Removing hyperframe (6.0.1)
  - Removing importlib-resources (6.1.1)
  - Removing jsonschema (4.20.0)
  - Removing jsonschema-specifications (2023.11.2)
  - Removing kiwisolver (1.4.5)
  - Removing llama-index-embeddings-huggingface (0.1.4)
  - Removing llama-index-vector-stores-qdrant (0.1.3)
  - Removing markdown-it-py (3.0.0)
  - Removing matplotlib (3.8.2)
  - Removing mdurl (0.1.2)
  - Removing mpmath (1.3.0)
  - Removing portalocker (2.8.2)
  - Removing protobuf (4.25.1)
  - Removing pydub (0.25.1)
  - Removing pygments (2.17.2)
  - Removing pyparsing (3.1.1)
  - Removing qdrant-client (1.7.3)
  - Removing referencing (0.32.0)
  - Removing rich (13.7.0)
  - Removing rpds-py (0.14.1)
  - Removing semantic-version (2.10.0)
  - Removing shellingham (1.5.4)
  - Removing sympy (1.12)
  - Removing tomlkit (0.12.0)
  - Removing toolz (0.12.0)
  - Removing torch (2.1.2)
  - Removing typer (0.9.0)

Installing the current project: private-gpt (0.4.0)

Remove some package and after i run poetry install --extras "ui llms-llama-cpp embeddings-huggingface vector-stores-qdrant" comment The removed package is reinstalled.

When trying to do it again

Run comment poetry install --extras llms-llama-cpp

Out-put

Installing dependencies from lock file

No dependencies to install or update

Installing the current project: private-gpt (0.4.0)

Device information

Macbook pro 2019 2.4 GHz Quad-Core Intel Core i5 Intel Iris Plus Graphics 655 1536 MB

Python version

python3 --version
Python 3.11.8

Poetry version

poetry --version Poetry (version 1.8.2)

I can't install it

MYOUSUFFS avatar Apr 10 '24 04:04 MYOUSUFFS

Are you by chance running it in a virtualenv ? Poetry really doesn't like virtualenv, I had the exact same problem and running it without virtualenv solved it instantly.

fredericENA avatar Apr 11 '24 12:04 fredericENA

Have you tried if it was a virtualenv error? I use venv and I don't have any problem. Also, checking your case, remember that when you install a new extra dependency, you will need to concatenate all the extras. This is why after installing llama-cpp extra, many dependencies are removed :)

jaluma avatar Jul 10 '24 11:07 jaluma