langgraph new project has error ModuleNotFoundError: No module named 'configuration' #599

Closed
opened 2026-02-20 17:40:54 -05:00 by yindo · 8 comments
Owner

Originally created by @MichaelLi65535 on GitHub (Apr 23, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

langgraph new
langgraph dev

Error Message and Stack Trace (if applicable)

2025-04-23T06:09:13.198294Z [error    ] Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/starlette/routing.py", line 692, in lifespan
    async with self.lifespan_context(app) as maybe_state:
               ~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langgraph_runtime_inmem/lifespan.py", line 43, in lifespan
    await collect_graphs_from_env(True)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langgraph_api/graph.py", line 322, in collect_graphs_from_env
    graph = await run_in_executor(None, _graph_from_spec, spec)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langchain_core/runnables/config.py", line 616, in run_in_executor
    return await asyncio.get_running_loop().run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langchain_core/runnables/config.py", line 607, in wrapper
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langgraph_api/graph.py", line 362, in _graph_from_spec
    modspec.loader.exec_module(module)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File ".../genai/test/src/agent/graph.py", line 11, in <module>
    from configuration import Configuration
ModuleNotFoundError: No module named 'configuration'
Could not import python module for graph:
GraphSpec(id='agent', path='./src/agent/graph.py', module=None, variable='graph', config={}, description=None)
This error likely means you haven't installed your project and its dependencies yet. Before running the server, install your project:

If you are using requirements.txt:
python -m pip install -r requirements.txt

If you are using pyproject.toml or setuptools:
python -m pip install -e .

Make sure to run this command from your project's root directory (where your setup.py or pyproject.toml is located)

Description

After using "langgraph new" to create a new langgraph project, then run "langgraph dev" to run it, it throws the error as listed

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:05 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T8132
Python Version: 3.13.3 (main, Apr 8 2025, 13:54:08) [Clang 16.0.0 (clang-1600.0.26.6)]

Package Information

langchain_core: 0.3.55
langsmith: 0.3.33
langgraph_sdk: 0.1.63

Optional packages not installed

langserve

Other Dependencies

httpx: 0.28.1
jsonpatch<2.0,>=1.33: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
openai-agents: Installed. No version info available.
opentelemetry-api: Installed. No version info available.
opentelemetry-exporter-otlp-proto-http: Installed. No version info available.
opentelemetry-sdk: Installed. No version info available.
orjson: 3.10.16
packaging: 24.2
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.11.3
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pytest: Installed. No version info available.
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.3
requests-toolbelt: 1.0.0
rich: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
typing-extensions>=4.7: Installed. No version info available.
zstandard: 0.23.0

Originally created by @MichaelLi65535 on GitHub (Apr 23, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use GitHub Discussions. - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python langgraph new langgraph dev ``` ### Error Message and Stack Trace (if applicable) ```shell 2025-04-23T06:09:13.198294Z [error ] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/starlette/routing.py", line 692, in lifespan async with self.lifespan_context(app) as maybe_state: ~~~~~~~~~~~~~~~~~~~~~^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py", line 214, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langgraph_runtime_inmem/lifespan.py", line 43, in lifespan await collect_graphs_from_env(True) File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langgraph_api/graph.py", line 322, in collect_graphs_from_env graph = await run_in_executor(None, _graph_from_spec, spec) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langchain_core/runnables/config.py", line 616, in run_in_executor return await asyncio.get_running_loop().run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langchain_core/runnables/config.py", line 607, in wrapper return func(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/langgraph_api/graph.py", line 362, in _graph_from_spec modspec.loader.exec_module(module) ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ File "<frozen importlib._bootstrap_external>", line 1026, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File ".../genai/test/src/agent/graph.py", line 11, in <module> from configuration import Configuration ModuleNotFoundError: No module named 'configuration' Could not import python module for graph: GraphSpec(id='agent', path='./src/agent/graph.py', module=None, variable='graph', config={}, description=None) This error likely means you haven't installed your project and its dependencies yet. Before running the server, install your project: If you are using requirements.txt: python -m pip install -r requirements.txt If you are using pyproject.toml or setuptools: python -m pip install -e . Make sure to run this command from your project's root directory (where your setup.py or pyproject.toml is located) ``` ### Description After using "langgraph new" to create a new langgraph project, then run "langgraph dev" to run it, it throws the error as listed ### System Info System Information ------------------ > OS: Darwin > OS Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:05 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T8132 > Python Version: 3.13.3 (main, Apr 8 2025, 13:54:08) [Clang 16.0.0 (clang-1600.0.26.6)] Package Information ------------------- > langchain_core: 0.3.55 > langsmith: 0.3.33 > langgraph_sdk: 0.1.63 Optional packages not installed ------------------------------- > langserve Other Dependencies ------------------ > httpx: 0.28.1 > jsonpatch<2.0,>=1.33: Installed. No version info available. > langsmith-pyo3: Installed. No version info available. > langsmith<0.4,>=0.1.125: Installed. No version info available. > openai-agents: Installed. No version info available. > opentelemetry-api: Installed. No version info available. > opentelemetry-exporter-otlp-proto-http: Installed. No version info available. > opentelemetry-sdk: Installed. No version info available. > orjson: 3.10.16 > packaging: 24.2 > packaging<25,>=23.2: Installed. No version info available. > pydantic: 2.11.3 > pydantic<3.0.0,>=2.5.2;: Installed. No version info available. > pydantic<3.0.0,>=2.7.4;: Installed. No version info available. > pytest: Installed. No version info available. > PyYAML>=5.3: Installed. No version info available. > requests: 2.32.3 > requests-toolbelt: 1.0.0 > rich: Installed. No version info available. > tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available. > typing-extensions>=4.7: Installed. No version info available. > zstandard: 0.23.0
yindo added the question label 2026-02-20 17:40:54 -05:00
yindo closed this issue 2026-02-20 17:40:54 -05:00
Author
Owner

@vbarda commented on GitHub (Apr 23, 2025):

Just confirming that you did this from the error message:

If you are using requirements.txt:
python -m pip install -r requirements.txt

If you are using pyproject.toml or setuptools:
python -m pip install -e .
@vbarda commented on GitHub (Apr 23, 2025): Just confirming that you did this from the error message: ``` If you are using requirements.txt: python -m pip install -r requirements.txt If you are using pyproject.toml or setuptools: python -m pip install -e . ```
Author
Owner

@MichaelLi65535 commented on GitHub (Apr 23, 2025):

Hi @vbarda , I did the second way. I noticed that the error comes from the zip file/sample codes when we run "langgraph new" to create a new project, and I made a fix with the PR at https://github.com/langchain-ai/new-langgraph-project/pull/4

@MichaelLi65535 commented on GitHub (Apr 23, 2025): Hi @vbarda , I did the second way. I noticed that the error comes from the zip file/sample codes when we run "langgraph new" to create a new project, and I made a fix with the PR at https://github.com/langchain-ai/new-langgraph-project/pull/4
Author
Owner

@MichaelLi65535 commented on GitHub (Apr 23, 2025):

Maybe I should close this issue as although this is related to the cli command from langgraph, the error actually comes from the sample codes from another repo?

@MichaelLi65535 commented on GitHub (Apr 23, 2025): Maybe I should close this issue as although this is related to the cli command from langgraph, the error actually comes from the sample codes from another repo?
Author
Owner

@hinthornw commented on GitHub (Apr 23, 2025):

The package has to be installed locally before running, and you'll want to make sure the langgraph cli is aware of the current python environment :)

There's two things that may be happening here:

  1. the langgraph command is global and so not picking up your local virtual environment. You could use something liek uv or poetry and run uv run langgraph dev to pick up the local deps
  2. The local package wasn't installed (either pip install -e . or just use uv or poetry and it should be included for you)
@hinthornw commented on GitHub (Apr 23, 2025): The package has to be installed locally before running, and you'll want to make sure the `langgraph` cli is aware of the current python environment :) There's two things that may be happening here: 1. the `langgraph` command is global and so not picking up your local virtual environment. You could use something liek `uv` or `poetry` and run `uv run langgraph dev` to pick up the local deps 2. The local package wasn't installed (either pip install -e . or just use `uv` or `poetry` and it should be included for you)
Author
Owner

@MichaelLi65535 commented on GitHub (Apr 23, 2025):

Hi @hinthornw , thanks for the reply. I tried both and still have the same issue. It's not related to external package, it's actually related to the project's own classes. To be more specially, it's related to the sample codes graph.py line 11 and 12:

from agent.configuration import Configuration
from agent.state import State

It's missing src. for agent.configuration and agent.state

@MichaelLi65535 commented on GitHub (Apr 23, 2025): Hi @hinthornw , thanks for the reply. I tried both and still have the same issue. It's not related to external package, it's actually related to the project's own classes. To be more specially, it's related to the sample codes graph.py line 11 and 12: from agent.configuration import Configuration from agent.state import State It's missing src. for agent.configuration and agent.state
Author
Owner

@sameerjj commented on GitHub (May 6, 2025):

Hi all, I have the same issue for myself. I am new to python so I don't completely understand my fix but, it seems building the project with uv sync causes the absolute package declaration of agent to fail to resolve when calling langgraph dev. when I cleaned everything, and reverted to pip, it started to work. take that as you will!

@sameerjj commented on GitHub (May 6, 2025): Hi all, I have the same issue for myself. I am new to python so I don't completely understand my fix but, it seems building the project with `uv sync` causes the absolute package declaration of `agent` to fail to resolve when calling `langgraph dev`. when I cleaned everything, and reverted to pip, it started to work. take that as you will!
Author
Owner

@hinthornw commented on GitHub (May 7, 2025):

Python dep management is kinda a pain. I'd recomend using something like uv to manage deps.

  1. Install uv (which bundles uvx with it)
curl -LsSf https://astral.sh/uv/install.sh | sh

or if you're on windows

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  1. Run the cli
uvx --with-editable . --from "langgraph-cli[inmem]" langgraph dev

The reason for this is that langgraph-cli executable needs to be run within the environment with the deps installed. It is likely that if you are just running langgraph dev, that it's falling back to a global installation.

The following works just fine, but is very verbose.

  1. langgraph new
  2. python3 -m venv .venv
  3. source .venv/bin/activate
  4. python3 -m pip install -e .
    If you run which langgraph here, it'll point to some global installation, like:
which langgraph
/Users/wfh/.local/bin/langgraph
  1. python3 -m pip install "langgraph-cli[inmem] && source .venv/bin/activate"

Now if you run which langgraph it should be correct.

/Users/wfh/path/to/tmp/.venv/bin/langgraph
  1. langgraph dev
@hinthornw commented on GitHub (May 7, 2025): Python dep management is kinda a pain. I'd recomend using something like `uv` to manage deps. 1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/#installation-methods) (which bundles `uvx` with it) ```shell curl -LsSf https://astral.sh/uv/install.sh | sh ``` or if you're on windows ```shell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` 2. Run the cli ```shell uvx --with-editable . --from "langgraph-cli[inmem]" langgraph dev ``` The reason for this is that `langgraph-cli` executable needs to be run within the environment with the deps installed. It is likely that if you are just running `langgraph dev`, that it's falling back to a global installation. The following works just fine, but is very verbose. 1. langgraph new 2. python3 -m venv .venv 3. source .venv/bin/activate 4. python3 -m pip install -e . If you run `which langgraph` here, it'll point to some global installation, like: ```shell which langgraph /Users/wfh/.local/bin/langgraph ``` 5. python3 -m pip install "langgraph-cli[inmem] && source .venv/bin/activate" Now if you run `which langgraph` it should be correct. ```shell /Users/wfh/path/to/tmp/.venv/bin/langgraph ``` 7. langgraph dev
Author
Owner

@sameerjj commented on GitHub (May 7, 2025):

after much pain and agony, just wanted to put in thread that fullstack python example is likely a better starter project.

It uses uv and provides the uv commands you need to build and run langgraph locally. I found that the langgraph new project often the cli binary was not in the venv and as @hinthornw mentioned, you need to use your local langgraph for all of this to work.

@sameerjj commented on GitHub (May 7, 2025): after much pain and agony, just wanted to put in thread that [fullstack python example](https://github.com/langchain-ai/langgraph-fullstack-python/tree/main) is likely a better starter project. It uses uv and provides the uv commands you need to build and run langgraph locally. I found that the langgraph new project often the cli binary was not in the venv and as @hinthornw mentioned, you need to use your local langgraph for all of this to work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#599