I get the following error (in the graph.py file) when a try to boot up langgraph studio from a nested package.
from .components.models import AgentState
ImportError: attempted relative import with no known parent package
I'm aware this may be more of a usability issue than a bug, but I simply don't know how to solve it because I have very little control over how docker is used to package the graphs.
Project structure is the following:
As you can see, all elements in the project hierarchy are python packages, starting from tutorials.
Unfortunately, the packaging doesn't work when running langgraph studio, although it does when importing from pure python code.
When attempting to start the graph in langgraph studio, I get:
ImportError: attempted relative import with no known parent package
I tried absolute imports like this:
from tutorials.topics.rag.agentic_rag.components.models import AgentState
but that doesn't work either as the docker process / container has no visibility over directories / modules above the langgraph.json (I get no module "tutorials" found error in this case.
Is there a better to achieve the result I want that would be compatible with both running from a python script and in the langgraph studio app?
I get the following error (in the
graph.py
file) when a try to boot up langgraph studio from a nested package.ImportError: attempted relative import with no known parent package
I'm aware this may be more of a usability issue than a bug, but I simply don't know how to solve it because I have very little control over how docker is used to package the graphs.
Project structure is the following:
As you can see, all elements in the project hierarchy are python packages, starting from tutorials.
Unfortunately, the packaging doesn't work when running langgraph studio, although it does when importing from pure python code. When attempting to start the graph in langgraph studio, I get:
ImportError: attempted relative import with no known parent package
I tried absolute imports like this:
but that doesn't work either as the docker process / container has no visibility over directories / modules above the langgraph.json (I get
no module "tutorials" found
error in this case.Is there a better to achieve the result I want that would be compatible with both running from a python script and in the langgraph studio app?