Hello, I am trying to deploy my app con railway, but this is the issue I am encountering.
This is the server.py file content:
"""
import os
from dotenv import load_dotenv
from fastapi import FastAPI
from langserve import add_routes
from app.agent_v1 import part_3_graph as agent_v1
load_dotenv()
app = FastAPI()
@app.get("/")
async def root():
return {
"message": "Welcome to the langserve server! More information and routes can be found at /docs. π¦ π",
}
Hello, I am trying to deploy my app con railway, but this is the issue I am encountering.
This is the server.py file content:
""" import os from dotenv import load_dotenv from fastapi import FastAPI from langserve import add_routes from app.agent_v1 import part_3_graph as agent_v1
load_dotenv()
app = FastAPI()
@app.get("/") async def root(): return { "message": "Welcome to the langserve server! More information and routes can be found at /docs. π¦ π", }
@app.get("/health") async def health_check(): return {"status": "healthy"}
add_routes(app, agent_v1, path="/agent")
if name == "main": import uvicorn
"""
AND THIS IS THE ERROR SHOWING ON RAILWAY (THE DEPLOYMENT LOGS)
""" INFO: Will watch for changes in these directories: ['/app']
INFO: Uvicorn running on http://0.0.0.0:5816/ (Press CTRL+C to quit)
INFO: Started reloader process [7] using StatReload
Process SpawnProcess-1:
Traceback (most recent call last):
File "/root/.nix-profile/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/root/.nix-profile/lib/python3.11/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/opt/venv/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "/opt/venv/lib/python3.11/site-packages/uvicorn/server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.nix-profile/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/root/.nix-profile/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.nix-profile/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.11/site-packages/uvicorn/server.py", line 68, in serve
config.load()
File "/opt/venv/lib/python3.11/site-packages/uvicorn/config.py", line 467, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.11/site-packages/uvicorn/importer.py", line 24, in import_from_string
raise exc from None
File "/opt/venv/lib/python3.11/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.nix-profile/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 "/app/app/server.py", line 4, in
from langserve import add_routes
File "/opt/venv/lib/python3.11/site-packages/langserve/init.py", line 7, in
from langserve.api_handler import APIHandler
File "/opt/venv/lib/python3.11/site-packages/langserve/api_handler.py", line 31, in
from langchain_core.callbacks.base import AsyncCallbackHandler
File "/opt/venv/lib/python3.11/site-packages/langchain_core/callbacks/init.py", line 9, in
from langchain_core.callbacks.base import (
File "/opt/venv/lib/python3.11/site-packages/langchain_core/callbacks/base.py", line 7, in
from tenacity import RetryCallState
File "/opt/venv/lib/python3.11/site-packages/tenacity/init.py", line 653, in
from tenacity.asyncio import AsyncRetrying # noqa:E402,I100 """