kayak / pypika

PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.
http://pypika.readthedocs.io/en/latest/
Apache License 2.0
2.54k stars 296 forks source link

Query Attribute Not Found #764

Open Tripsette opened 1 year ago

Tripsette commented 1 year ago

Working in a python 3.11.5 venv, environment variables appear correct, I've been slowly pushing through one pypika error after another attempting to use PrivateGPT's sentence-transformers. The most recent issue (not finding dialects module) was fixed by manually cloning the main repo, changing into directory, and pip install -e . to manually install pypika over itself (after having tried to uninstall and reinstall and upgrade with pip dozens of times failed to get dialects module recognized.) Current Error, "Module 'pypika' has no attribute 'Query'" (I've very freshly reinstalled windows, uninstalled/reinstalled conda/python/everything else, it shouldn't be one of the main "have you tried this?" that openai chatgpt or bingchat suggests. I'm not a developer, and barely understand what I'm doing in anything later than Basic, C, C++, HTML, or very very early Java, I've been out of the programming game for decades.)

`(PrivateGPT) D:\privateGPT\pypika>pip install -e .
Obtaining file:///D:/privateGPT/pypika
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: PyPika
  Building editable for PyPika (pyproject.toml) ... done
  Created wheel for PyPika: filename=PyPika-0.48.9-0.editable-py2.py3-none-any.whl size=16376 sha256=68a8fe25615b8d307f971db08ec1d746eb7c0a1f8ef20f4bd28ee8c7ac4005d1
  Stored in directory: C:\Users\jacob\AppData\Local\Temp\pip-ephem-wheel-cache-2evkicod\wheels\eb\ca\1f\78ff9f5c545914cc9050bca83ddc27a60fcc8c44a011c3ccf5
Successfully built PyPika
Installing collected packages: PyPika
  Attempting uninstall: PyPika
    Found existing installation: PyPika 0.48.9
    Uninstalling PyPika-0.48.9:
      Successfully uninstalled PyPika-0.48.9
Successfully installed PyPika-0.48.9

(PrivateGPT) D:\privateGPT\pypika>cd ..

(PrivateGPT) D:\privateGPT>python ingest.py
Traceback (most recent call last):
  File "D:\privateGPT\ingest.py", line 185, in <module>
    main()
  File "D:\privateGPT\ingest.py", line 157, in main
    chroma_client = chromadb.PersistentClient(settings=CHROMA_SETTINGS , path=persist_directory)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\__init__.py", line 106, in PersistentClient
    return Client(settings)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\__init__.py", line 143, in Client
    api = system.instance(API)
          ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\config.py", line 248, in instance
    impl = type(self)
           ^^^^^^^^^^
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\api\segment.py", line 83, in __init__
    self._sysdb = self.require(SysDB)
                  ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\config.py", line 189, in require
    inst = self._system.instance(type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\config.py", line 245, in instance
    type = get_class(fqn, type)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\config.py", line 294, in get_class
    module = importlib.import_module(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\db\impl\sqlite.py", line 2, in <module>
    from chromadb.db.migrations import MigratableDB, Migration
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\db\migrations.py", line 6, in <module>
    from chromadb.db.base import SqlDB, Cursor
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\db\base.py", line 69, in <module>
    class SqlDB(Component):
  File "C:\Users\jacob\.conda\envs\PrivateGPT\Lib\site-packages\chromadb\db\base.py", line 82, in SqlDB
    def querybuilder() -> Type[pypika.Query]:
                               ^^^^^^^^^^^^
AttributeError: module 'pypika' has no attribute 'Query'`
wd60622 commented 1 year ago

Seems like that is something wrong with chromadb rather than pypika as it is happening in their codebase. Have you raised an issue with that project?

Tripsette commented 1 year ago

I shall head over there and do that, thank you! AI chatbots directed me to post here first, but I suppose it makes more sense to check over there, since the errors are coming from chromadb modules.