ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

[Question]: Installing ragflow on MacStudio (M2 Max chip)

Open rudysev opened this issue 1 year ago • 5 comments

Describe your problem

I have trying to download and start the docker image, it looks like the ragflow server is up and it is responding in the browser, but the response I get when opening my browser is:

{
  "data": null,
  "retcode": 100,
  "retmsg": "\u003CNotFound '404: Not Found'\u003E"
}

Here are the logs of the docker command:

(venv) rudys@mac-studio ~/.../Software/ragflow/docker % docker compose -f docker-compose.yml up -d
[+] Running 6/6
 ✔ Container ragflow-redis                                                                                                                                Running                                                              0.0s
 ✔ Container ragflow-mysql                                                                                                                                Healthy                                                             10.8s
 ✔ Container ragflow-es-01                                                                                                                                Healthy                                                             10.8s
 ✔ Container ragflow-minio                                                                                                                                Running                                                              0.0s
 ✔ Container ragflow-server                                                                                                                               Started                                                             11.0s
 ! ragflow The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested                                                                      0.0s

Note: it complains about linux/amd64 and the arm64/v8 platform, but I am not sure how to change the requested image.

Here are the logs from ragflow-server:

(venv) rudys@mac-studio ~/.../Software/ragflow/docker % docker logs -f ragflow-server
[WARNING] [2024-10-16 05:01:33,606] [synonym.__init__] [line:40]: Realtime synonym is disabled, since no redis connection.
[WARNING] [2024-10-16 05:01:33,611] [synonym.__init__] [line:40]: Realtime synonym is disabled, since no redis connection.
[WARNING] [2024-10-16 05:01:34,080] [synonym.__init__] [line:40]: Realtime synonym is disabled, since no redis connection.
[WARNING] [2024-10-16 05:01:34,085] [synonym.__init__] [line:40]: Realtime synonym is disabled, since no redis connection.
[WARNING] Load term.freq FAIL!
[WARNING] Load term.freq FAIL!

        ____   ___    ______ ______ __
       / __ \ /   |  / ____// ____// /____  _      __
      / /_/ // /| | / / __ / /_   / // __ \| | /| / /
     / _, _// ___ |/ /_/ // __/  / // /_/ /| |/ |/ /
    /_/ |_|/_/  |_|\____//_/    /_/ \____/ |__/|__/


[INFO] [2024-10-16 05:01:40,089] [_internal._log] [line:96]: WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:9380
 * Running on http://xxx.xx.xx.xxx:9380
[INFO] [2024-10-16 05:01:40,089] [_internal._log] [line:96]: Press CTRL+C to quit

Any help would be appreciated please.

rudysev avatar Oct 16 '24 05:10 rudysev

Your machine is kind of arm64, you can build it by yourself on a linux/arm64 host:

docker build --build-arg ARCH=arm64 -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
docker build --build-arg ARCH=arm64 -f Dockerfile -t infiniflow/ragflow:dev .

KevinHuSh avatar Oct 17 '24 01:10 KevinHuSh

Your machine is kind of arm64, you can build it by yourself on a linux/arm64 host:

docker build --build-arg ARCH=arm64 -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
docker build --build-arg ARCH=arm64 -f Dockerfile -t infiniflow/ragflow:dev .

Thank you for this tip. I am having issues when specifying arm64 as the arch:

Dockerfile:27
--------------------
  26 |     # aspose-slides on linux/arm64 is unavailable
  27 | >>> RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
  28 | >>>     if [ "${ARCH}" = "amd64" ]; then \
  29 | >>>         dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb; \
  30 | >>>     fi
  31 |
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref gu9u6d3l1ynin9ji1s3i5a59d::rmln8rwgwqqztdrvlagfj73hy: "/libssl1.1_1.1.1f-1ubuntu2_amd64.deb": not found

rudysev avatar Oct 17 '24 06:10 rudysev

Here's instructions on Build a Docker image on linux/amd64. Follow these instructions with changing the docker build command on linux/arm64 as @KevinHuSh said.

yuzhichang avatar Oct 19 '24 04:10 yuzhichang

Here's instructions on Build a Docker image on linux/amd64. Follow these instructions with changing the docker build command on linux/arm64 as @KevinHuSh said.

I followed the instructions on this page and used @KevinHuSh command using ARCH=arm64 but got the error message from my previous comment.

rudysev avatar Oct 20 '24 04:10 rudysev

@rudysev Did you follow the following step in the instructions? It downloads libssl1.1_1.1.1f-1ubuntu2_amd64.deb which needed by the Dockerfile.

python3 download_deps.py

yuzhichang avatar Oct 20 '24 09:10 yuzhichang

Closed due to no response from the author in 5 days.

yuzhichang avatar Oct 25 '24 01:10 yuzhichang

Sorry for not responding before, I did not see the message. I ran the python command, thank you. I am getting a new error when building:

(venv) rudys@mac-studio ~/Documents/Software/ragflow % docker build --build-arg ARCH=arm64 -f Dockerfile -t infiniflow/ragflow:v0.12.0 .
[+] Building 395.3s (31/35)                                                                                                                                            docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                   0.0s
 => => transferring dockerfile: 4.19kB                                                                                                                                                 0.0s
 => [internal] load metadata for docker.io/library/ubuntu:24.04                                                                                                                        1.0s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                        0.0s
 => [internal] load build context                                                                                                                                                      0.1s
 => => transferring context: 141.05kB                                                                                                                                                  0.1s
 => [base 1/7] FROM docker.io/library/ubuntu:24.04@sha256:99c35190e22d294cdace2783ac55effc69d32896daaa265f0bbedbcde4fbe3e5                                                             0.0s
 => => resolve docker.io/library/ubuntu:24.04@sha256:99c35190e22d294cdace2783ac55effc69d32896daaa265f0bbedbcde4fbe3e5                                                                  0.0s
 => CACHED [base 2/7] WORKDIR /ragflow                                                                                                                                                 0.0s
 => CACHED [base 3/7] RUN rm -f /etc/apt/apt.conf.d/docker-clean     && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache                     0.0s
 => CACHED [base 4/7] RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked     apt update && apt-get --no-install-recommends install -y ca-certificates     0.0s
 => CACHED [base 5/7] RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources                                           0.0s
 => CACHED [base 6/7] RUN --mount=type=cache,id=ragflow_base_apt,target=/var/cache/apt,sharing=locked     apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-  0.0s
 => CACHED [base 7/7] RUN --mount=type=bind,source=libssl1.1_1.1.1f-1ubuntu2_amd64.deb,target=/root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb     if [ "arm64" = "amd64" ]; then         dp  0.0s
 => CACHED [builder 1/6] WORKDIR /ragflow                                                                                                                                              0.0s
 => CACHED [builder 2/6] RUN --mount=type=cache,id=ragflow_builder_apt,target=/var/cache/apt,sharing=locked     apt update && apt install -y nodejs npm cargo &&     rm -rf /var/lib/  0.0s
 => CACHED [builder 3/6] COPY web web                                                                                                                                                  0.0s
 => CACHED [builder 4/6] RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked     cd web && npm i --force && npm run build                                   0.0s
 => CACHED [builder 5/6] COPY pyproject.toml poetry.toml poetry.lock ./                                                                                                                0.0s
 => CACHED [production  2/18] RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=locked     apt update && apt install -y --no-install-recommends nginx li  0.0s
 => CACHED [production  3/18] COPY web web                                                                                                                                             0.0s
 => CACHED [production  4/18] COPY api api                                                                                                                                             0.0s
 => CACHED [production  5/18] COPY conf conf                                                                                                                                           0.0s
 => CACHED [production  6/18] COPY deepdoc deepdoc                                                                                                                                     0.0s
 => CACHED [production  7/18] COPY rag rag                                                                                                                                             0.0s
 => CACHED [production  8/18] COPY agent agent                                                                                                                                         0.0s
 => CACHED [production  9/18] COPY graphrag graphrag                                                                                                                                   0.0s
 => CACHED [production 10/18] COPY pyproject.toml poetry.toml poetry.lock ./                                                                                                           0.0s
 => CACHED [production 11/18] RUN mkdir -p /ragflow/rag/res/deepdoc /root/.ragflow                                                                                                     0.0s
 => CACHED [production 12/18] RUN --mount=type=bind,source=huggingface.co,target=/huggingface.co     tar --exclude='.*' -cf -         /huggingface.co/InfiniFlow/text_concat_xgb_v1.0  0.0s
 => ERROR [builder 6/6] RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked     if [ "0" -eq 0 ]; then         poetry install --sync --no-  394.3s
 => [production 13/18] RUN --mount=type=bind,source=huggingface.co,target=/huggingface.co     tar -cf -         /huggingface.co/BAAI/bge-large-zh-v1.5         /huggingface.co/BAAI/b  6.8s
 => [production 14/18] COPY nltk_data /root/nltk_data                                                                                                                                  0.2s
------
 > [builder 6/6] RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked     if [ "0" -eq 0 ]; then         poetry install --sync --no-root --with=full;     else         poetry install --sync --no-root;     fi:
0.579 Creating virtualenv ragflow in /ragflow/.venv
0.783 Installing dependencies from lock file
1.294
1.294 Package operations: 319 installs, 0 updates, 0 removals
1.294
1.295   - Installing pyasn1 (0.6.1)
4.683   - Installing cachetools (5.3.3)
4.684   - Installing certifi (2024.8.30)
4.685   - Installing charset-normalizer (3.3.2)
4.685   - Installing idna (3.10)
4.686   - Installing protobuf (5.27.2)
4.687   - Installing pyasn1-modules (0.4.1)
4.688   - Installing pycparser (2.22)
4.690   - Installing rsa (4.9)
4.692   - Installing urllib3 (2.2.3)
6.121   - Installing attrs (24.2.0)
6.122   - Installing cffi (1.17.1)
6.122   - Installing filelock (3.15.4)
6.123   - Installing frozenlist (1.4.1)
6.123   - Installing fsspec (2024.6.1)
6.124   - Installing google-auth (2.35.0)
6.125   - Installing googleapis-common-protos (1.65.0)
6.125   - Installing markupsafe (2.1.5)
6.126   - Installing multidict (6.1.0)
6.128   - Installing grpcio (1.66.2)
6.129   - Installing packaging (24.1)
6.130   - Installing proto-plus (1.24.0)
6.132   - Installing numpy (1.26.4)
6.135   - Installing requests (2.32.2)
6.135   - Installing six (1.16.0)
6.136   - Installing pyyaml (6.0.2)
6.532   - Installing tqdm (4.66.5)
6.723   - Installing typing-extensions (4.12.2)
10.83   - Installing aiohappyeyeballs (2.4.2)
10.83   - Installing aiosignal (1.3.1)
10.83   - Installing alabaster (0.7.16)
10.83   - Installing babel (2.16.0)
10.83   - Installing docutils (0.20.1)
10.83   - Installing google-api-core (2.20.0)
10.84   - Installing google-crc32c (1.6.0)
10.84   - Installing h11 (0.14.0)
10.84   - Installing huggingface-hub (0.25.1)
10.84   - Installing jinja2 (3.1.4)
10.85   - Installing joblib (1.4.2)
10.85   - Installing llvmlite (0.43.0)
10.85   - Installing cryptography (43.0.1)
10.85   - Installing grpcio-status (1.66.2)
10.85   - Installing jmespath (1.0.1)
10.85   - Installing imagesize (1.4.1)
11.17   - Installing mdurl (0.1.2)
11.18   - Installing mpmath (1.3.0)
11.18   - Installing outcome (1.3.0.post0)
11.20   - Installing pygments (2.18.0)
11.22   - Installing pyparsing (3.1.4)
11.25   - Installing python-dateutil (2.8.2)
11.28   - Installing scipy (1.12.0)
11.31   - Installing sniffio (1.3.1)
11.39   - Installing snowballstemmer (2.2.0)
11.40   - Installing sortedcontainers (2.4.0)
11.46   - Installing sphinxcontrib-applehelp (2.0.0)
11.46   - Installing sphinxcontrib-devhelp (2.0.0)
11.48   - Installing sphinxcontrib-htmlhelp (2.1.0)
11.54   - Installing sphinxcontrib-jsmath (1.0.1)
11.60   - Installing sphinxcontrib-qthelp (2.0.0)
11.63   - Installing sphinxcontrib-serializinghtml (2.0.0)
11.63   - Installing threadpoolctl (3.5.0)
11.72   - Installing yarl (1.13.1)
12.60   - Installing aiohttp (3.10.8)
12.60   - Installing annotated-types (0.7.0)
12.60   - Installing botocore (1.34.140)
12.60   - Installing cbor (1.0.0)
12.60   - Installing contourpy (1.3.0)
12.60   - Installing cycler (0.12.1)
12.60   - Installing dill (0.3.8)
12.60   - Installing fonttools (4.54.1)
12.60   - Installing google-cloud-core (2.4.1)
12.60   - Installing google-resumable-media (2.7.2)
12.60   - Installing grpc-google-iam-v1 (0.13.1)
12.61   - Installing httplib2 (0.22.0)
12.61   - Installing humanfriendly (10.0)
12.61   - Installing kiwisolver (1.4.7)
12.61   - Installing lxml (5.3.0)
12.61   - Installing markdown-it-py (3.0.0)
12.95   - Installing networkx (3.3)
13.05   - Installing numba (0.60.0)
13.11   - Installing pillow (10.3.0)
13.12   - Installing pydantic-core (2.23.4)
13.12   - Installing pyjwt (2.8.0)
13.13   - Installing pysocks (1.7.1)
13.14   - Installing pytz (2020.5)
13.14   - Installing regex (2024.9.11)
13.16   - Installing safetensors (0.4.5)
13.25   - Installing scikit-learn (1.5.0)
13.25   - Installing soupsieve (2.6)
13.49   - Installing sphinx (7.4.7)
13.83   - Installing sympy (1.13.3)
14.07   - Installing tokenizers (0.15.2)
14.19   - Installing trio (0.26.2)
14.23   - Installing tzdata (2024.2)
14.24   - Installing wrapt (1.16.0)
14.31   - Installing wsproto (1.2.0)
16.19   - Installing anyio (4.6.0)
16.19   - Installing argon2-cffi-bindings (21.2.0)
16.19   - Installing autograd (1.7.0)
16.19   - Installing azure-core (1.31.0)
16.19   - Installing beautifulsoup4 (4.12.3)
16.19   - Installing biothings-client (0.3.1)
16.19   - Installing blinker (1.8.2)
16.19   - Installing click (8.1.7)
16.19   - Installing coloredlogs (15.0.1)
16.19   - Installing decorator (5.1.1)
16.19   - Installing cramjam (2.8.4)
16.19   - Installing docstring-parser (0.16)
16.19   - Installing elastic-transport (8.12.0)
16.20   - Installing flatbuffers (24.3.25)
16.20   - Installing future (1.0.0)
16.20   - Installing et-xmlfile (1.1.0)
16.53   - Installing google-auth-httplib2 (0.2.0)
16.53   - Installing google-cloud-bigquery (3.26.0)
16.55   - Installing google-cloud-resource-manager (1.12.5)
16.55   - Installing google-cloud-storage (2.18.2)
16.56   - Installing httpcore (1.0.5)
16.57   - Installing ijson (3.3.0)
16.57   - Installing inscriptis (2.5.0)
16.59   - Installing isodate (0.6.1)
16.77   - Installing itsdangerous (2.1.2)
16.91   - Installing lz4 (4.3.3)
16.92   - Installing matplotlib (3.9.2)
16.93   - Installing msal (1.31.0)
16.93   - Installing multiprocess (0.70.16)
16.94   - Installing pandas (2.2.2)
16.95   - Installing patsy (0.5.6)
16.95   - Installing platformdirs (4.3.6)
16.96   - Installing portalocker (2.10.1)
16.96   - Installing psutil (6.0.0)
16.98   - Installing py (1.11.0)
17.02   - Installing pyarrow (17.0.0)
17.05   - Installing pycryptodome (3.9.9)
17.08   - Installing pydantic (2.9.2)
17.09   - Installing pynndescent (0.5.13)
17.46   - Installing rich (13.8.1)
17.46   - Installing s3transfer (0.10.2)
17.49   - Installing sgmllib3k (1.0.0)
17.49   - Installing shapely (2.0.5)
17.52   - Installing shellingham (1.5.4)
17.55   - Installing smart-open (7.0.4)
17.55   - Installing sphinxcontrib-jquery (4.1)
17.56   - Installing torch (2.3.0)
17.60   - Installing transformers (4.38.1)
17.62   - Installing trec-car-tools (2.6)
17.77   - Installing trio-websocket (0.11.1)
17.79   - Installing types-python-dateutil (2.9.0.20240906)
17.80   - Installing unlzw3 (0.2.2)
17.82   - Installing uritemplate (4.1.1)
17.84   - Installing warc3-wet (0.2.5)
17.85   - Installing warc3-wet-clueweb09 (0.2.5)
17.91   - Installing wcwidth (0.2.13)
17.92   - Installing webencodings (0.5.1)
18.02   - Installing websocket-client (1.8.0)
18.05   - Installing werkzeug (3.0.3)
18.05   - Installing xxhash (3.5.0)
18.07   - Installing zlib-state (0.1.9)
394.1
394.1   IncompleteRead
394.1
394.1   IncompleteRead(2113276 bytes read, 327529 more expected)
394.1
394.1   at /usr/lib/python3/dist-packages/urllib3/response.py:835 in _raw_read
394.1        831│                     # to concerns of backward compatibility. We're
394.1        832│                     # addressing it here to make sure IncompleteRead is
394.1        833│                     # raised during streaming, so all calls with incorrect
394.1        834│                     # Content-Length are caught.
394.1     →  835│                     raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
394.1        836│
394.1        837│         if data:
394.1        838│             self._fp_bytes_read += len(data)
394.1        839│             if self.length_remaining is not None:
394.1
394.1 The following error occurred when trying to handle this error:
394.1
394.1
394.1   ProtocolError
394.1
394.1   ('Connection broken: IncompleteRead(2113276 bytes read, 327529 more expected)', IncompleteRead(2113276 bytes read, 327529 more expected))
394.1
394.1   at /usr/lib/python3/dist-packages/urllib3/response.py:727 in _error_catcher
394.1        723│                 raise ReadTimeoutError(self._pool, None, "Read timed out.") from e  # type: ignore[arg-type]
394.1        724│
394.1        725│             except (HTTPException, OSError) as e:
394.1        726│                 # This includes IncompleteRead.
394.1     →  727│                 raise ProtocolError(f"Connection broken: {e!r}", e) from e
394.1        728│
394.1        729│             # If no exception is thrown, we should avoid cleaning up
394.1        730│             # unnecessarily.
394.1        731│             clean_exit = True
394.1
394.1 The following error occurred when trying to handle this error:
394.1
394.1
394.1   ChunkedEncodingError
394.1
394.1   ('Connection broken: IncompleteRead(2113276 bytes read, 327529 more expected)', IncompleteRead(2113276 bytes read, 327529 more expected))
394.1
394.1   at /usr/lib/python3/dist-packages/requests/models.py:818 in generate
394.1        814│             if hasattr(self.raw, "stream"):
394.1        815│                 try:
394.1        816│                     yield from self.raw.stream(chunk_size, decode_content=True)
394.1        817│                 except ProtocolError as e:
394.1     →  818│                     raise ChunkedEncodingError(e)
394.1        819│                 except DecodeError as e:
394.1        820│                     raise ContentDecodingError(e)
394.1        821│                 except ReadTimeoutError as e:
394.1        822│                     raise ConnectionError(e)
394.1
394.1 Cannot install shapely.
394.1
394.1 Warning: The file chosen for install of aiohappyeyeballs 2.4.2 (aiohappyeyeballs-2.4.2-py3-none-any.whl) is yanked. Reason for being yanked: Regression: https://github.com/aio-libs/aiohappyeyeballs/issues/100
------
Dockerfile:57
--------------------
  56 |
  57 | >>> RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
  58 | >>>     if [ "$LIGHTEN" -eq 0 ]; then \
  59 | >>>         poetry install --sync --no-root --with=full; \
  60 | >>>     else \
  61 | >>>         poetry install --sync --no-root; \
  62 | >>>     fi
  63 |
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ \"$LIGHTEN\" -eq 0 ]; then         poetry install --sync --no-root --with=full;     else         poetry install --sync --no-root;     fi" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/k550n03mvzz8fs3b03e1l2poh

rudysev avatar Oct 25 '24 02:10 rudysev

dev built was able to build successfully - issue seems to be with v0.12.0

rudysev avatar Oct 25 '24 03:10 rudysev

Hi, I am getting same error when trying to build on a M3 Max, I have followed the recommended steps:

pip3 install huggingface-hub nltk
python3 download_deps.py

And then I have tried:

docker build --build-arg ARCH=arm64 -f Dockerfile -t infiniflow/ragflow:dev .

But I got the same error:

...
Dockerfile:61
--------------------
  60 |
  61 | >>> RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
  62 | >>>     if [ "$LIGHTEN" -eq 0 ]; then \
  63 | >>>         poetry install --no-root --with=full; \
  64 | >>>     else \
  65 | >>>         poetry install --no-root; \
  66 | >>>     fi
  67 |
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ \"$LIGHTEN\" -eq 0 ]; then         poetry install --no-root --with=full;     else         poetry install --no-root;     fi" did not complete successfully: exit code: 1

Any suggestions?

UPDATE: For some reason, the $LIGHTENenv variable , though defined, it was not properly recognized in the conditional statement, so I have modified the Dockerfile in order to force the installation of poetryas follows:

# install dependencies from poetry.lock file
COPY pyproject.toml poetry.toml poetry.lock ./

RUN echo "LIGHTEN value is: $LIGHTEN" && \
    poetry install --no-root --with=full

With this change, I managed to fully build ragflow:dev under arm64 architecture

ibagur avatar Nov 10 '24 18:11 ibagur

What about exec export LIGHTEN=0 before building image?

KevinHuSh avatar Nov 11 '24 03:11 KevinHuSh

What about exec export LIGHTEN=0 before building image?

I already managed to build the image, but that could be an option also, thanks!

ibagur avatar Nov 11 '24 10:11 ibagur