benman1 / generative_ai_with_langchain

Build large language model (LLM) apps with Python, ChatGPT and other models. This is the companion repository for the book on generative AI with LangChain.
https://amzn.to/43PuIkQ
MIT License
600 stars 242 forks source link

Dockerfile failed to build #2

Closed shiyanch closed 11 months ago

shiyanch commented 11 months ago

I followed instructions from the book as well as this repo's README.md. However, the Dockerfile seems not work.

Two issues I have encountered:

  1. Dockerfile references to langchain_ai.yml whereas the actual file is langchain_ai.yaml.
  2. After fixing the above issue, I still got the following errors from docker build -t langchain_ai .:

[+] Building 3.1s (10/11)                                                                                                                                docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                                     0.0s
 => => transferring dockerfile: 451B                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/continuumio/miniconda3:latest                                                                                                 0.7s
 => [auth] continuumio/miniconda3:pull token for registry-1.docker.io                                                                                                    0.0s
 => [1/6] FROM docker.io/continuumio/miniconda3@sha256:db9f536d96d49fe21b5f4ac3252781bb0d2a3b58dab2d8e44343b85014366f00                                                  0.0s
 => [internal] load build context                                                                                                                                        0.0s
 => => transferring context: 473B                                                                                                                                        0.0s
 => CACHED [2/6] RUN conda update -n base -c defaults conda                                                                                                              0.0s
 => CACHED [3/6] COPY langchain_ai.yml .                                                                                                                                 0.0s
 => CACHED [4/6] COPY notebooks ./notebooks                                                                                                                              0.0s
 => ERROR [5/6] RUN conda env create -f langchain_ai.yml                                                                                                                 2.3s
------
 > [5/6] RUN conda env create -f langchain_ai.yml:
0.365 Collecting package metadata (repodata.json): ...working... done
2.124 Solving environment: ...working... failed
2.125
2.125 ResolvePackageNotFound:
2.125   - sqlite==3.41.2=h6c40b1e_0
2.125   - tk==8.6.12=h5d9f67b_0
2.125   - xz==5.4.2=h6c40b1e_0
2.125   - openssl==3.0.9=hca72f7f_0
2.125   - zlib==1.2.13=h4dc903c_0
2.125   - bzip2==1.0.8=h1de35cc_0
2.125   - libffi==3.4.4=hecd8cb5_0
2.125   - readline==8.2=hca72f7f_0
2.125   - python==3.10.12=h5ee71fb_0
2.125   - ca-certificates==2023.05.30=hecd8cb5_0
2.125   - ncurses==6.4=hcec6c5f_0
2.125
------
Dockerfile:8
--------------------
   6 |     COPY langchain_ai.yml .
   7 |     COPY notebooks ./notebooks
   8 | >>> RUN conda env create -f langchain_ai.yml
   9 |     WORKDIR /home
  10 |     EXPOSE 8080
--------------------
ERROR: failed to solve: process "/bin/sh -c conda env create -f langchain_ai.yml" did not complete successfully: exit code: 1```
benman1 commented 11 months ago

Hi @shiyanch Thanks for the description and for identifying a wrongly named file. I've just corrected this. Please note, however, that the book is not out yet. Hopefully, it will come out at the end of this month.

I think this problem was caused by the library hashes being specific to macos - they don't work with other architectures/operating systems. I've just removed the hashes, and I've made more changes to the installation. I think this should be added somewhere in the conda documentation, other people were struggling with this problem as well.

I also found that the installation would take extremely long in conda and often times out. I've commented on a workaround for the timeout in the README, and I've made a few more changes to the Dockerfile to speed up the installation. For me, it's still excruciatingly slow. If you test it, let me know what you get, please.