infiniflow / ragflow

RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding.
https://ragflow.io
Apache License 2.0
22.64k stars 2.22k forks source link

Macosx M1 not supported? #1164

Closed yangboz closed 4 months ago

yangboz commented 5 months ago

Describe your problem

Container ragflow-es-01 [+] Running 6/6 Healthy10.8s ✔ Container ragflow-mysql Healthy10.8s ✔ Container ragflow-redis Running0.0s s ✔ Container ragflow-es-01 Healthy10.8s ✔ Container ragflow-minio Running0.0s ✔ Container ragflow-server Started11.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

any idea ? thanks a lot.

JinHai-CN commented 5 months ago

RAGFlow is supposed to support Aarch64 machine. We only built and uploaded x86 docker image. For ARM machine such as MAC m1, you need to use https://github.com/infiniflow/ragflow/blob/main/Dockerfile.arm to compile RAGFlow docker image.

MohammedAlghamdi94 commented 5 months ago

The RAGFlow image still produces an error even with requirments_arm.txt and Dockerfile.arm being used on Apple M2 chip

nikitashekhov commented 5 months ago

Agree. When you use this in order to build arm image: docker build -t infiniflow/ragflow:dev -f Dockerfile.arm .

you always get similiar errors:

The conflict is caused by:
257.1     The user requested pycryptodome>=3.20.0
257.1     minio 7.2.4 depends on pycryptodome
257.1     volcengine 1.0.141 depends on pycryptodome==3.9.9

and since changing requirements.txt causes Docker not using cache it takes almost forever to fix it. I gave up.

Could you fix arm reqs, please?

MI-Class commented 5 months ago

Remove version information

nikitashekhov commented 5 months ago

Remove version information

For which package(s)? Every time I change requirements Docker not using cache it takes almost forever to fix it. I gave up.

KevinHuSh commented 4 months ago

My best practice is that ignore the version conflicts and build the image anyway. Then, start the container go into it, pip install all the 'module not found can't resolve'. At last, docker commit.

MI-Class commented 4 months ago

删除版本信息

适用于哪些套餐?每次我更改要求 Docker 不使用缓存时,几乎需要很长时间才能修复它。我放弃了。

会出现两次版本冲突,运行的时候也会出现两次缺少包,建议忽略版本冲突构建,这是我修改后的 accelerate==0.27.2 aiohttp==3.9.3 aiosignal==1.3.1 annotated-types==0.6.0 anyio==4.3.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0

Aspose.Slides==24.2.0

attrs==23.2.0 blinker==1.7.0 cachelib==0.12.0 cachetools==5.3.3 certifi==2024.2.2 cffi==1.16.0 charset-normalizer==3.3.2 click==8.1.7 coloredlogs==15.0.1 cryptography==42.0.5 dashscope==1.14.1 datasets==2.17.1 datrie==0.8.2 demjson3==3.0.6 dill==0.3.8 distro==1.9.0 elastic-transport==8.12.0 elasticsearch==8.12.1 elasticsearch-dsl==8.12.0 et-xmlfile==1.1.0 filelock==3.13.1 fastembed==0.2.6 FlagEmbedding==1.2.5 Flask==3.0.2 Flask-Cors==4.0.0 Flask-Login==0.6.3 Flask-Session==0.6.0 flatbuffers==23.5.26 frozenlist==1.4.1 fsspec==2023.10.0 h11==0.14.0 hanziconv==0.3.2 httpcore==1.0.4 httpx==0.27.0 huggingface-hub==0.20.3 humanfriendly==10.0 idna==3.6 install==1.3.5 itsdangerous==2.1.2 Jinja2==3.1.3 joblib==1.3.2 lxml==5.1.0 MarkupSafe==2.1.5 minio==7.2.4 mpmath==1.3.0 multidict==6.0.5 multiprocess==0.70.16 networkx==3.2.1 nltk==3.8.1 numpy==1.26.4

nvidia-cublas-cu12==12.1.3.1

nvidia-cuda-cupti-cu12==12.1.105

nvidia-cuda-nvrtc-cu12==12.1.105

nvidia-cuda-runtime-cu12==12.1.105

nvidia-cudnn-cu12==8.9.2.26

nvidia-cufft-cu12==11.0.2.54

nvidia-curand-cu12==10.3.2.106

nvidia-cusolver-cu12==11.4.5.107

nvidia-cusparse-cu12==12.1.0.106

nvidia-nccl-cu12==2.19.3

nvidia-nvjitlink-cu12==12.3.101

nvidia-nvtx-cu12==12.1.105

ollama==0.1.9

onnxruntime-gpu==1.17.1

openai==1.12.0 opencv-python==4.9.0.80 openpyxl==3.1.2 packaging==23.2 pandas==2.2.1 pdfminer.six==20221105 pdfplumber==0.10.4 peewee==3.17.1 pillow==10.2.0 protobuf==4.25.3 psutil==5.9.8 pyarrow==15.0.0 pyarrow-hotfix==0.6 pyclipper==1.3.0.post5 pycparser==2.21 pycryptodome pycryptodome-test-vectors==1.0.14 pycryptodomex==3.20.0 pydantic==2.6.2 pydantic_core==2.16.3 PyJWT==2.8.0 PyMySQL==1.1.0 PyPDF2==3.0.1 pypdfium2==4.27.0 python-dateutil==2.8.2 python-docx==1.1.0 python-dotenv==1.0.1 python-pptx==0.6.23 pytz PyYAML==6.0.1 redis==5.0.3 regex==2023.12.25 requests==2.31.0 ruamel.yaml==0.18.6 ruamel.yaml.clib==0.2.8 safetensors==0.4.2 scikit-learn==1.4.1.post1 scipy==1.12.0 sentence-transformers==2.4.0 shapely==2.0.3 six==1.16.0 sniffio==1.3.1 StrEnum==0.4.15 sympy==1.12 threadpoolctl==3.3.0 tika==2.6.0 tiktoken==0.6.0 tokenizers==0.15.2 torch==2.2.1 tqdm==4.66.2 transformers==4.38.1

triton==2.2.0

typing_extensions==4.10.0 tzdata==2024.1 urllib3==2.2.1 Werkzeug==3.0.1 xgboost==2.0.3 XlsxWriter==3.2.0 xpinyin==0.7.6 xxhash==3.4.1 yarl==1.9.4 zhipuai==2.0.1 BCEmbedding loguru==0.7.2 umap-learn fasttext==0.9.2 volcengine==1.0.141 opencv-python-headless==4.9.0.80 readability-lxml==0.8.1 html_text==0.6.2 cn2an==0.5.22 roman-numbers==1.0.2 word2number==1.1

aopstudio commented 4 months ago

I have updated the requirements_arm.txt and Dockerfile.arm. Now we can successfully build the Docker image for ARM.

nikitashekhov commented 4 months ago

@aopstudio thanks! That worked, I was able to build on Mac M1 MAX:

[+] Building 1250.0s (11/20)                                                                                                                            docker:desktop-linux 
[+] Building 1257.5s (21/21) FINISHED                                                                                                                   docker:desktop-linux 
 => [internal] load build definition from Dockerfile.arm                                                                                                                0.0s 
 => => transferring dockerfile: 906B                                                                                                                                    0.0s 
 => [internal] load metadata for docker.io/library/python:3.11                                                                                                          0.6s 
 => [internal] load .dockerignore                                                                                                                                       0.0s 
 => => transferring context: 2B                                                                                                                                         0.0s 
 => [ 1/16] FROM docker.io/library/python:3.11@sha256:01b1035a2912ade481cf6db2381d                                                  0.0s 
 => [internal] load build context                                                                                                                                       0.0s 
 => => transferring context: 41.70kB                                                                                                                                    0.0s 
 => CACHED [ 2/16] WORKDIR /ragflow                                                                                                                                     0.0s 
 => CACHED [ 3/16] COPY requirements_arm.txt /ragflow/requirements.txt                                                                                                  0.0s 
 => [ 4/16] RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --default-timeout=1000 -r requirements.txt &&python -c "import nltk;nltk.download('punkt');nl  972.7s 
 => [ 5/16] RUN apt-get update &&     apt-get install -y curl gnupg &&     rm -rf /var/lib/apt/lists/*                                                                  6.9s 
 => [ 6/16] RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - &&     apt-get install -y --fix-missing nodejs nginx ffmpeg libsm6 libxext6 libgl1            128.7s 
 => [ 7/16] ADD ./web ./web                                                                                                                                             0.1s 
 => [ 8/16] RUN cd ./web && npm i --force && npm run build                                                                                                            143.7s
 => [ 9/16] ADD ./api ./api                                                                                                                                             0.0s 
 => [10/16] ADD ./conf ./conf                                                                                                                                           0.0s 
 => [11/16] ADD ./deepdoc ./deepdoc                                                                                                                                     0.0s 
 => [12/16] ADD ./rag ./rag                                                                                                                                             0.0s 
 => [13/16] ADD ./graph ./graph                                                                                                                                         0.0s 
 => [14/16] ADD docker/entrypoint.sh ./entrypoint.sh                                                                                                                    0.0s
 => [15/16] ADD docker/.env ./                                                                                                                                          0.0s
 => [16/16] RUN chmod +x ./entrypoint.sh                                                                                                                                0.1s
 => exporting to image                                                                                                                                                  4.7s
 => => exporting layers                                                                                                                                                 4.7s
 => => writing image sha256:a330d9ed0984                                                                          0.0s
 => => naming to docker.io/infiniflow/ragflow:dev   

But in the dashboard I get sometimes:

image

and

image

And on completion I get some sentences cut every time. I am using llama3:

image

Everythin up and running, no error logs in other containers:

image

Thanks for the support!

aopstudio commented 4 months ago

@nikitashekhov

  1. If you can get your files parsed successfully, then you can ignore the redis no such key error.
  2. About IndexError..., I have never seen this before. Could you tell us when you got this error? Maybe you can check the logs to find out the reason.
  3. To solve the issue about sentences cut, you can adjust the Max Tokens in Chat Configuration-Model setting
yangboz commented 4 months ago

@aopstudio thanks! That worked, I was able to build on Mac M1 MAX:

[+] Building 1250.0s (11/20)                                                                                                                            docker:desktop-linux 
[+] Building 1257.5s (21/21) FINISHED                                                                                                                   docker:desktop-linux 
 => [internal] load build definition from Dockerfile.arm                                                                                                                0.0s 
 => => transferring dockerfile: 906B                                                                                                                                    0.0s 
 => [internal] load metadata for docker.io/library/python:3.11                                                                                                          0.6s 
 => [internal] load .dockerignore                                                                                                                                       0.0s 
 => => transferring context: 2B                                                                                                                                         0.0s 
 => [ 1/16] FROM docker.io/library/python:3.11@sha256:01b1035a2912ade481cf6db2381d                                                  0.0s 
 => [internal] load build context                                                                                                                                       0.0s 
 => => transferring context: 41.70kB                                                                                                                                    0.0s 
 => CACHED [ 2/16] WORKDIR /ragflow                                                                                                                                     0.0s 
 => CACHED [ 3/16] COPY requirements_arm.txt /ragflow/requirements.txt                                                                                                  0.0s 
 => [ 4/16] RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --default-timeout=1000 -r requirements.txt &&python -c "import nltk;nltk.download('punkt');nl  972.7s 
 => [ 5/16] RUN apt-get update &&     apt-get install -y curl gnupg &&     rm -rf /var/lib/apt/lists/*                                                                  6.9s 
 => [ 6/16] RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - &&     apt-get install -y --fix-missing nodejs nginx ffmpeg libsm6 libxext6 libgl1            128.7s 
 => [ 7/16] ADD ./web ./web                                                                                                                                             0.1s 
 => [ 8/16] RUN cd ./web && npm i --force && npm run build                                                                                                            143.7s
 => [ 9/16] ADD ./api ./api                                                                                                                                             0.0s 
 => [10/16] ADD ./conf ./conf                                                                                                                                           0.0s 
 => [11/16] ADD ./deepdoc ./deepdoc                                                                                                                                     0.0s 
 => [12/16] ADD ./rag ./rag                                                                                                                                             0.0s 
 => [13/16] ADD ./graph ./graph                                                                                                                                         0.0s 
 => [14/16] ADD docker/entrypoint.sh ./entrypoint.sh                                                                                                                    0.0s
 => [15/16] ADD docker/.env ./                                                                                                                                          0.0s
 => [16/16] RUN chmod +x ./entrypoint.sh                                                                                                                                0.1s
 => exporting to image                                                                                                                                                  4.7s
 => => exporting layers                                                                                                                                                 4.7s
 => => writing image sha256:a330d9ed0984                                                                          0.0s
 => => naming to docker.io/infiniflow/ragflow:dev   

But in the dashboard I get sometimes: image and image

And on completion I get some sentences cut every time. I am using llama3: image

Everythin up and running, no error logs in other containers: image

Thanks for the support! follow previous step it works on M 1 too.

LONGDDSF commented 4 months ago

I have updated the requirements_arm.txt and Dockerfile.arm. Now we can successfully build the Docker image for ARM.

which branch?

yangboz commented 4 months ago

I have updated the requirements_arm.txt and Dockerfile.arm. Now we can successfully build the Docker image for ARM.

which branch? Commit Id: df7675a grep: /etc/-release: No such file or directory grep: /etc/-release: No such file or directory Operating system: (Kernel version: 22.6.0) CPU Type: arm64 Memory: Docker Version: 24.0.5, Python Version: 3.11.0

taochen2001 commented 2 months ago

@MI-Class I think you should remove install==1.3.5 from the requirements_arm.txt as it is not an actual python package. otherwise, people will run into:

31.00 ERROR: No matching distribution found for install

alanyoungcy commented 2 months ago

@aopstudio thanks! That worked, I was able to build on Mac M1 MAX:

[+] Building 1250.0s (11/20)                                                                                                                            docker:desktop-linux 
[+] Building 1257.5s (21/21) FINISHED                                                                                                                   docker:desktop-linux 
 => [internal] load build definition from Dockerfile.arm                                                                                                                0.0s 
 => => transferring dockerfile: 906B                                                                                                                                    0.0s 
 => [internal] load metadata for docker.io/library/python:3.11                                                                                                          0.6s 
 => [internal] load .dockerignore                                                                                                                                       0.0s 
 => => transferring context: 2B                                                                                                                                         0.0s 
 => [ 1/16] FROM docker.io/library/python:3.11@sha256:01b1035a2912ade481cf6db2381d                                                  0.0s 
 => [internal] load build context                                                                                                                                       0.0s 
 => => transferring context: 41.70kB                                                                                                                                    0.0s 
 => CACHED [ 2/16] WORKDIR /ragflow                                                                                                                                     0.0s 
 => CACHED [ 3/16] COPY requirements_arm.txt /ragflow/requirements.txt                                                                                                  0.0s 
 => [ 4/16] RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --default-timeout=1000 -r requirements.txt &&python -c "import nltk;nltk.download('punkt');nl  972.7s 
 => [ 5/16] RUN apt-get update &&     apt-get install -y curl gnupg &&     rm -rf /var/lib/apt/lists/*                                                                  6.9s 
 => [ 6/16] RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - &&     apt-get install -y --fix-missing nodejs nginx ffmpeg libsm6 libxext6 libgl1            128.7s 
 => [ 7/16] ADD ./web ./web                                                                                                                                             0.1s 
 => [ 8/16] RUN cd ./web && npm i --force && npm run build                                                                                                            143.7s
 => [ 9/16] ADD ./api ./api                                                                                                                                             0.0s 
 => [10/16] ADD ./conf ./conf                                                                                                                                           0.0s 
 => [11/16] ADD ./deepdoc ./deepdoc                                                                                                                                     0.0s 
 => [12/16] ADD ./rag ./rag                                                                                                                                             0.0s 
 => [13/16] ADD ./graph ./graph                                                                                                                                         0.0s 
 => [14/16] ADD docker/entrypoint.sh ./entrypoint.sh                                                                                                                    0.0s
 => [15/16] ADD docker/.env ./                                                                                                                                          0.0s
 => [16/16] RUN chmod +x ./entrypoint.sh                                                                                                                                0.1s
 => exporting to image                                                                                                                                                  4.7s
 => => exporting layers                                                                                                                                                 4.7s
 => => writing image sha256:a330d9ed0984                                                                          0.0s
 => => naming to docker.io/infiniflow/ragflow:dev   

But in the dashboard I get sometimes: image and image

And on completion I get some sentences cut every time. I am using llama3: image

Everythin up and running, no error logs in other containers: image

Thanks for the support!

Thank you for showing the success, may I wonder if you can share the Dockerfile and the requirements.tx? In particular, the Dockerfile may use apt-get, which is not available, while I tried to manually install all dependencies, but still facing many conflicts. Is is possible to share a workable Mac configs? many thanks!

severian42 commented 3 weeks ago

I was able to build the Docker on my M3 MacBook just by changing the arch name in the Dockerfile. I changed the amd64 to arm64 and then built it using the embedded model version of ragflow:dev

    if [ "${ARCH}" = "arm64" ]; then \
        dpkg -i /root/libssl1.1_1.1.1f-1ubuntu2_amd64.deb; \
    fi

Might not be the smartest or cleanest fix but everything is built perfectly and runs fine so far. I'll delete this if it ends up ruining anything so no one else gets swayed

yangboz commented 3 weeks ago

you can try to add arm64v8/ prefix for M1 mysql docker image name. then pull it. may it works.