bhaskatripathi / pdfGPT

PDF GPT allows you to chat with the contents of your PDF file by using GPT capabilities. The most effective open source solution to turn your pdf files in a chatbot!
https://huggingface.co/spaces/bhaskartripathi/pdfGPT_Turbo
MIT License
6.98k stars 837 forks source link

lc-serve on Macbook M1/M2 #97

Open vipervs opened 1 year ago

vipervs commented 1 year ago

i have a MacBook M2 and this problem when trying to launch:

(venv_pdfGPT)  ~/pdfGPT/ [main] lc-serve deploy local api ⠋ Waiting ... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/1 -:--:--ERROR gateway/rep-0@20705 ImportError("dlopen(/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/_fitz.so, 0x0002): [08/23/23 20:08:36] tried: '/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/_fitz.so' (mach-o file, but is an incompatible
architecture (have 'x86_64', need 'arm64')),
'/System/Volumes/Preboot/Cryptexes/OS/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/_fitz.so' (no such file),
'/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/_fitz.so' (mach-o file, but is an incompatible architecture
(have 'x86_64', need 'arm64'))") during 'GatewayRuntime' initialization
add "--quiet-error" to suppress the exception details
Traceback (most recent call last):
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/orchestrate/pods/init.py", line 89, in run
runtime = AsyncNewLoopRuntime(
^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/serve/runtimes/asyncio.py", line 81, in init
self._loop.run_until_complete(self.async_setup())
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/nest_asyncio.py", line 99, in run_until_complete
return f.result()
^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/futures.py",
line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/tasks.py",
line 267, in step
result = coro.send(None)
^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/serve/runtimes/asyncio.py", line 255, in async_setup
self.server = self._get_server()
^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/serve/runtimes/asyncio.py", line 159, in _get_server
return BaseGateway.load_config(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/jaml/init.py", line 792, in load_config
obj = JAML.load(tag_yml, substitute=False, runtime_args=runtime_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/jaml/
init.py", line 174, in load
r = yaml.load(stream, Loader=get_jina_loader_with_runtime(runtime_args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/yaml/
init.py", line 81, in load
return loader.get_single_data()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/yaml/constructor.py", line 51, in get_single_data
return self.construct_document(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/yaml/constructor.py", line 55, in construct_document
data = self.construct_object(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/yaml/constructor.py", line 100, in construct_object
data = constructor(self, node)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/jaml/
init__.py", line 582, in _from_yaml
return get_parser(cls, version=data.get('version', None)).parse(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/jaml/parsers/gateway/legacy.py", line 56, in parse
obj = cls(
^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/serve/helper.py", line 72, in arg_wrapper
f = func(self,
args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/lcserve/backend/gateway.py", line 300, in init
self._register_modules()
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/lcserve/backend/gateway.py", line 408, in _register_modules
self._register_mod(mod)
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/lcserve/backend/gateway.py", line 412, in _register_mod
app_module = import_module(mod)
^^^^^^^^^^^^^^^^^^
File
"/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/init.py", line
126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/andi/pdfGPT/api.py", line 8, in
import fitz
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/init.py", line 22, in
from fitz.fitz import
File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/fitz.py", line 14, in
from . import _fitz
ImportError: dlopen(/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/_fitz.so, 0x0002): tried:
'/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/_fitz.so' (mach-o file, but is an incompatible architecture
(have 'x86_64', need 'arm64')),
'/System/Volumes/Preboot/Cryptexes/OS/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/_fitz.so' (no such file),
'/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/fitz/_fitz.so' (mach-o file, but is an incompatible architecture
(have 'x86_64', need 'arm64'))
ERROR Flow@20695 Flow is aborted due to ['gateway'] can not be started. [08/23/23 20:08:36] Traceback (most recent call last): File "/Users/andi/pdfGPT/venv_pdfGPT/bin/lc-serve", line 8, in sys.exit(serve()) ^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/click/core.py", line 1157, in call return self.main(
args,
kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/lcserve/main.py", line 664, in local serve_locally(module_str=module_str, fastapi_app_str=app, port=port, env=env) File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/lcserve/main.py", line 57, in serve_locally with Flow.load_config(f_yaml) as f: File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/orchestrate/orchestrator.py", line 14, in enter return self.start() ^^^^^^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/orchestrate/flow/builder.py", line 33, in arg_wrapper return func(self, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/orchestrate/flow/base.py", line 1832, in start self._wait_until_all_ready() File "/Users/andi/pdfGPT/venv_pdfGPT/lib/python3.11/site-packages/jina/orchestrate/flow/base.py", line 1975, in _wait_until_all_ready raise RuntimeFailToStart jina.excepts.RuntimeFailToStart

kshitijsriv commented 1 year ago

were you able to resolve this issue?

vipervs commented 1 year ago

No I found that it is not solvable, there is a conflict between two dependencies on silicon Mac:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. pydantic-core 2.6.3 requires typing-extensions!=4.7.0,>=4.6.0, but you have typing-extensions 4.5.0 which is incompatible. pydantic 2.3.0 requires typing-extensions>=4.6.1, but you have typing-extensions 4.5.0 which is incompatible.

and

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow-macos 2.13.0 requires typing-extensions<4.6.0,>=3.6.6, but you have typing-extensions 4.7.1 which is incompatible.

kshitijsriv commented 1 year ago

This made me laugh at my helplessness here. Thanks for this. I'll try setting this up on a linux machine.