jina-ai / langchain-serve

⚡ Langchain apps in production using Jina & FastAPI
https://cloud.jina.ai
Apache License 2.0
1.61k stars 138 forks source link

lc-serve deploy local - Doesn't work on Windows 10 #135

Open prek-prek opened 1 year ago

prek-prek commented 1 year ago

I've tried deploying an api.py app on Windows 10 and keep getting the same error. Script works fine on WSL through PowerShell.

Here are my logs:

(myenv) C:\Users\Użytkownik\Desktop\chatpdf>lc-serve deploy local api
⠙ Waiting gateway... ---------------------------------------- 0/1 0:00:04DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html (raised from C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\hubble\executor\requirements.py:7)
DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py:2871)
DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.logging')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py:2871)
DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py:2350)
⠹ Waiting gateway... ---------------------------------------- 0/1 0:00:04DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py:2871)
DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py:2871)
⠹ Waiting gateway... ---------------------------------------- 0/1 0:00:08ERROR  gateway/rep-0@13296 FileNotFoundError('can not find                                           [08/03/23 19:12:18]
       C:\\Users\\Użytkownik\\AppData\\Local\\Programs\\Python\\Python39\\\nlib\\site-packages\\lcs…
       during 'GatewayRuntime' initialization
        add "--quiet-error" to suppress the exception details
       Traceback (most recent call last):
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\serve\exe…
       line 140, in run
           runtime = AsyncNewLoopRuntime(
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\serve\run…
       line 90, in __init__
           self._loop.run_until_complete(self.async_setup())
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\nest_asyncio.p…
       line 99, in run_until_complete
           return f.result()
         File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\asyncio\futures.py",
       line 201, in result
           raise self._exception
         File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\asyncio\tasks.py",
       line 256, in __step
           result = coro.send(None)
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\serve\run…
       line 270, in async_setup
           self.server = self._get_server()
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\serve\run…
       line 168, in _get_server
           server = BaseGateway.load_config(
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\jaml\__in…
       line 695, in load_config
           stream, s_path = parse_config_source(
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\jaml\help…
       line 191, in parse_config_source
           PathImporter.add_modules(module_name)
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\importer.…
       line 161, in add_modules
           _path_import(complete_path(m))
         File
       "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\jaml\help…
       line 229, in complete_path
           raise FileNotFoundError(f'can not find {path}')
       FileNotFoundError: can not find C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\
       lib\site-packages\lcserve\servinggateway_config
ERROR  Flow@24540 An exception occurred:                                                            [08/03/23 19:12:18]
ERROR  Flow@24540 Flow is aborted due to ['gateway'] can not be started.
Traceback (most recent call last):
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\Scripts\lc-serve.exe\__main__.py", line 7, in <module>
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\lcserve\__main__.py", line 660, in local
    serve_locally(module_str=module_str, fastapi_app_str=app, port=port, env=env)
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\lcserve\__main__.py", line 51, in serve_locally
    with Flow.load_config(f_yaml) as f:
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\orchestrate\orchestrator.py", line 14, in __enter__
    return self.start()
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\orchestrate\flow\builder.py", line 33, in arg_wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\orchestrate\flow\base.py", line 1843, in start
    self._wait_until_all_ready()
  File "C:\Users\Użytkownik\AppData\Local\Programs\Python\Python39\lib\site-packages\jina\orchestrate\flow\base.py", line 2009, in _wait_until_all_ready
    raise RuntimeFailToStart
jina.excepts.RuntimeFailToStart
usersina commented 1 year ago

This is not windows specific. I also have the same error using Ubuntu 22.04 using Python 3.11.5.

Error message:

AttributeError('pydantic_parent_namespace') during 'GatewayRuntime' initialization Flow@49194 Flow is aborted due to ['gateway'] can not be started. jina.excepts.RuntimeFailToStart

Full error log ```bash ai-service git:(main) ✗ lc-serve deploy local app ⠙ Waiting gateway... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/1 0:00:00INFO gateway/rep-0@49279 Registering HTTP route: ask [09/02/23 11:28:26] ERROR gateway/rep-0@49279 AttributeError('__pydantic_parent_namespace__') during 'GatewayRuntime' initialization add "--quiet-error" to suppress the exception details Traceback (most recent call last): File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/orchestrate/pods/__init__.py", line 89, in run runtime = AsyncNewLoopRuntime( ^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/serve/runtimes/asyncio.py", line 81, in __init__ self._loop.run_until_complete(self.async_setup()) File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/nest_asyncio.py", line 99, in run_until_complete return f.result() ^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/lib/python3.11/asyncio/futures.py", line 203, in result raise self._exception.with_traceback(self._exception_tb) File "/home/sina/.pyenv/versions/3.11.5/lib/python3.11/asyncio/tasks.py", line 267, in __step result = coro.send(None) ^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/serve/runtimes/asyncio.py", line 257, in async_setup await self.server.setup_server() File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/serve/runtimes/servers/http.py", line 119, in setup_server _install_health_check(app, self.logger) File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/serve/runtimes/servers/http.py", line 200, in _install_health_check from jina.serve.runtimes.gateway.models import JinaHealthModel File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/serve/runtimes/gateway/models.py", line 214, in protobuf_to_pydantic_model(proto) File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/serve/runtimes/gateway/models.py", line 173, in protobuf_to_pydantic_model field_type = protobuf_to_pydantic_model(f.message_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/serve/runtimes/gateway/models.py", line 173, in protobuf_to_pydantic_model field_type = protobuf_to_pydantic_model(f.message_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/serve/runtimes/gateway/models.py", line 207, in protobuf_to_pydantic_model model.update_forward_refs() File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/typing_extensions.py", line 2562, in wrapper return __arg(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/pydantic/main.py", line 1211, in update_forward_refs cls.model_rebuild(force=True) File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/pydantic/main.py", line 458, in model_rebuild _model_construction.unpack_lenient_weakvaluedict(cls.__pydantic_parent_namespace__) or {} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 210, in __getattr__ raise AttributeError(item) AttributeError: __pydantic_parent_namespace__ ERROR Flow@49194 Flow is aborted due to ['gateway'] can not be started. [09/02/23 11:28:26] Traceback (most recent call last): File "/home/sina/.pyenv/versions/ai-service/bin/lc-serve", line 8, in sys.exit(serve()) ^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/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 "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/lcserve/__main__.py", line 57, in serve_locally with Flow.load_config(f_yaml) as f: File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/orchestrate/orchestrator.py", line 14, in __enter__ return self.start() ^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/orchestrate/flow/builder.py", line 33, in arg_wrapper return func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/orchestrate/flow/base.py", line 1832, in start self._wait_until_all_ready() File "/home/sina/.pyenv/versions/3.11.5/envs/ai-service/lib/python3.11/site-packages/jina/orchestrate/flow/base.py", line 1975, in _wait_until_all_ready raise RuntimeFailToStart jina.excepts.RuntimeFailToStart ```
dzeroone commented 1 year ago

I am also having the same error with 3.8.18