langgraph icon indicating copy to clipboard operation
langgraph copied to clipboard

"langgraph build -t my-image" is looking for my_agentrequirements.txt

Open jalapenos8 opened this issue 9 months ago • 4 comments

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

pip install -U langgraph-cli
langgraph build -t my-image

Error Message and Stack Trace (if applicable)

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref hs3yoi3tayvt6spvwpv0p1c9c::wq6tygw2kum28g7cgho3uc954: "/my_agentrequirements.txt": not found

Description

I am trying to deploy LangGraph locally based on this tutorial https://langchain-ai.github.io/langgraph/how-tos/deploy-self-hosted/. Executing "langgraph build -t my-image" gives me error as shown above. In Docker Desktop, I found image is trying to "ADD my_agentrequirements.txt". My project structure is like this: my-app/ ├── my_agent │ ├── utils │ │ ├── init.py │ │ ├── tools.py │ │ ├── nodes.py │ │ └── state.py │ ├── init.py │ └── agent.py ├── .env ├── requirements.txt └── langgraph.json you can clone a rep from here https://github.com/langchain-ai/langgraph-example.git. However, it needs movement of requirements.txt to root directory. I found a solution to it: just rename "requirements.txt" into "my_agentrequirements.txt" and it will successfully build an image.

System Info

System Information

OS: Windows OS Version: 10.0.26100 Python Version: 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]

Package Information

langchain_core: 0.3.44 langsmith: 0.3.13 langgraph_cli: 0.1.76

Optional packages not installed

langserve

Other Dependencies

click: 8.1.7 httpx: 0.28.1 jsonpatch<2.0,>=1.33: Installed. No version info available. langgraph-api: Installed. No version info available. langsmith-pyo3: Installed. No version info available. langsmith<0.4,>=0.1.125: Installed. No version info available. orjson: 3.10.15 packaging: 24.2 packaging<25,>=23.2: Installed. No version info available. pydantic: 2.9.2 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. python-dotenv: 1.0.1 PyYAML>=5.3: Installed. No version info available. requests: 2.31.0 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

jalapenos8 avatar Mar 13 '25 16:03 jalapenos8

Not able to reproduce , I cloned the repository and tried reproducing the issue but it works for me and I am able to build the image

ps06756 avatar Mar 18 '25 05:03 ps06756

I tried once again with new cloned repo. here is error:

#7 [2/6] ADD my_agentrequirements.txt /deps/__outer_my_agent/my_agent/requirements.txt
#7 ERROR: failed to calculate checksum of ref hs3yoi3tayvt6spvwpv0p1c9c::wh7m90k98j9ct9cqh39kue82x: "/my_agentrequirements.txt": not found

#5 [1/6] FROM docker.io/langchain/langgraph-api:3.11@sha256:6322c3e19fad9bff26a521cc34dbd8c2327bcec92038a277fb97e00960499285
#5 CANCELED
------
 > [2/6] ADD my_agentrequirements.txt /deps/__outer_my_agent/my_agent/requirements.txt:
------
Dockerfile:6
--------------------
   4 |
   5 |     # -- Installing local requirements --
   6 | >>> ADD my_agent\requirements.txt /deps/__outer_my_agent/my_agent/requirements.txt
   7 |     RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -c /api/constraints.txt -r /deps/__outer_my_agent/my_agent/requirements.txt
   8 |     # -- End of local requirements install --
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref hs3yoi3tayvt6spvwpv0p1c9c::wh7m90k98j9ct9cqh39kue82x: "/my_agentrequirements.txt": not found

The image is trying to use "/my_agentrequirements.txt" instead of "/my_agent/requirements.txt".

jalapenos8 avatar Mar 19 '25 09:03 jalapenos8

@ps06756 were you trying to reproduce on windows?

eyurtsev avatar Apr 02 '25 14:04 eyurtsev

same here when use langgraph dockerfile on windows.

Yuhui0620 avatar Apr 11 '25 09:04 Yuhui0620

I believe this specific issue is resolved, but we've added https://github.com/langchain-ai/langgraph/issues/5029 to help avoid things like this in the future.

Going to close for now, feel free to ping me (or open a new issue) if this issue is still persisting.

sydney-runkle avatar Jun 11 '25 17:06 sydney-runkle

still exists with langgraph-cli==0.3.3

dockerfile example:

FROM test:3.11







# -- Installing local requirements --
ADD my_agent\requirements.txt /deps/__outer_my_agent/my_agent/requirements.txt  # 👈problem still exists

RUN PYTHONDONTWRITEBYTECODE=1 uv pip install --system --no-cache-dir -c /api/constraints.txt -r /deps/__outer_my_agent/my_agent/requirements.txt
# -- End of local requirements install --



# -- Adding non-package dependency my_agent --
ADD ./my_agent /deps/__outer_my_agent/my_agent
RUN set -ex && \
    for line in '[project]' \
                'name = "my_agent"' \
                'version = "0.1"' \
                '[tool.setuptools.package-data]' \
                '"*" = ["**/*"]' \
                '[build-system]' \
                'requires = ["setuptools>=61"]' \
                'build-backend = "setuptools.build_meta"'; do \
        echo "$line" >> /deps/__outer_my_agent/pyproject.toml; \
    done
# -- End of non-package dependency my_agent --



# -- Installing all local dependencies --

RUN PYTHONDONTWRITEBYTECODE=1 uv pip install --system --no-cache-dir -c /api/constraints.txt -e /deps/*

# -- End of local dependencies install --

ENV LANGSERVE_GRAPHS='{"agent": "/deps/__outer_my_agent/my_agent/agent.py:graph"}'







# -- Ensure user deps didn't inadvertently overwrite langgraph-api
RUN mkdir -p /api/langgraph_api /api/langgraph_runtime /api/langgraph_license &&     touch /api/langgraph_api/__init__.py /api/langgraph_runtime/__init__.py /api/langgraph_license/__init__.py
RUN PYTHONDONTWRITEBYTECODE=1 uv pip install --system --no-cache-dir --no-deps -e /api
# -- End of ensuring user deps didn't inadvertently overwrite langgraph-api --
# -- Removing pip from the final image ~<:===~~~ --
RUN pip uninstall -y pip setuptools wheel &&     rm -rf /usr/local/lib/python*/site-packages/pip* /usr/local/lib/python*/site-packages/setuptools* /usr/local/lib/python*/site-packages/wheel* &&     find /usr/local/bin -name "pip*" -delete || true
# pip removal for wolfi
RUN rm -rf /usr/lib/python*/site-packages/pip* /usr/lib/python*/site-packages/setuptools* /usr/lib/python*/site-packages/wheel* &&     find /usr/bin -name "pip*" -delete || true
RUN uv pip uninstall --system pip setuptools wheel && rm /usr/bin/uv /usr/bin/uvx
# -- End of pip removal --




Yuhui0620 avatar Jun 16 '25 08:06 Yuhui0620