opea-project / GenAIExamples

Generative AI Examples is a collection of GenAI examples such as ChatQnA, Copilot, which illustrate the pipeline capabilities of the Open Platform for Enterprise AI (OPEA) project.
https://opea.dev
Apache License 2.0
285 stars 195 forks source link

Not able to build ChatQnA on Mac #363

Open arun-gupta opened 5 months ago

arun-gupta commented 5 months ago

Configuration:

Chip: Apple M1 Max
macOS: 14.5

Followed the instructions at https://github.com/opea-project/GenAIExamples/blob/main/ChatQnA/docker/xeon/README.md

Trying to build the Docker image:

docker build --no-cache -t opea/reranking-tei:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/reranks/langchain/docker/Dockerfile .

gives the following error:

#0 52.09 Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
#0 52.33 Building wheels for collected packages: mapbox-earcut, pycollada
#0 52.33   Building wheel for mapbox-earcut (pyproject.toml): started
#0 52.61   Building wheel for mapbox-earcut (pyproject.toml): finished with status 'error'
#0 52.61   error: subprocess-exited-with-error
#0 52.61   
#0 52.61   × Building wheel for mapbox-earcut (pyproject.toml) did not run successfully.
#0 52.61   │ exit code: 1
#0 52.61   ╰─> [63 lines of output]
#0 52.61       running bdist_wheel
#0 52.61       running build
#0 52.61       running build_ext
#0 52.61       gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.11 -c flagcheck.cpp -o flagcheck.o -std=c++17
#0 52.61       gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.11 -c flagcheck.cpp -o flagcheck.o -std=c++14
#0 52.61       gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.11 -c flagcheck.cpp -o flagcheck.o -std=c++11
#0 52.61       Traceback (most recent call last):
#0 52.61         File "/home/user/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
#0 52.61           main()
#0 52.61         File "/home/user/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
#0 52.61           json_out['return_val'] = hook(**hook_input['kwargs'])
#0 52.61                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 52.61         File "/home/user/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
#0 52.61           return _build_backend().build_wheel(wheel_directory, config_settings,
#0 52.61                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 415, in build_wheel
#0 52.61           return self._build_with_temp_dir(
#0 52.61                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
#0 52.61           self.run_setup()
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 313, in run_setup
#0 52.61           exec(code, locals())
#0 52.61         File "<string>", line 21, in <module>
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 103, in setup
#0 52.61           return distutils.core.setup(**attrs)
#0 52.61                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 184, in setup
#0 52.61           return run_commands(dist)
#0 52.61                  ^^^^^^^^^^^^^^^^^^
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
#0 52.61           dist.run_commands()
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 970, in run_commands
#0 52.61           self.run_command(cmd)
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 974, in run_command
#0 52.61           super().run_command(command)
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
#0 52.61           cmd_obj.run()
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/command/bdist_wheel.py", line 373, in run
#0 52.61           self.run_command("build")
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
#0 52.61           self.distribution.run_command(command)
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 974, in run_command
#0 52.61           super().run_command(command)
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
#0 52.61           cmd_obj.run()
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 135, in run
#0 52.61           self.run_command(cmd_name)
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
#0 52.61           self.distribution.run_command(command)
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 974, in run_command
#0 52.61           super().run_command(command)
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 989, in run_command
#0 52.61           cmd_obj.run()
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 93, in run
#0 52.61           _build_ext.run(self)
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
#0 52.61           self.build_extensions()
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/pybind11/setup_helpers.py", line 285, in build_extensions
#0 52.61           ext.cxx_std = auto_cpp_level(self.compiler)
#0 52.61                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 52.61         File "/tmp/pip-build-env-twffyn_5/overlay/lib/python3.11/site-packages/pybind11/setup_helpers.py", line 268, in auto_cpp_level
#0 52.61           raise RuntimeError(msg)
#0 52.61       RuntimeError: Unsupported compiler -- at least C++11 support is needed!
#0 52.61       [end of output]
#0 52.61   
#0 52.61   note: This error originates from a subprocess, and is likely not a problem with pip.
#0 52.61   ERROR: Failed building wheel for mapbox-earcut
#0 52.61   Building wheel for pycollada (setup.py): started
#0 53.16   Building wheel for pycollada (setup.py): finished with status 'done'
#0 53.16   Created wheel for pycollada: filename=pycollada-0.8-py3-none-any.whl size=127515 sha256=c1a25d472de017c9f0b2081582cd902e6f5bdd9d0f37e509853ac203370a7db4
#0 53.16   Stored in directory: /tmp/pip-ephem-wheel-cache-28x2e1ki/wheels/72/f0/6c/2fd64355f3a11cb6673fd92e0417c5ed5bf37a796d9c180562
#0 53.16 Successfully built pycollada
#0 53.16 Failed to build mapbox-earcut
#0 53.16 ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mapbox-earcut)
------
Dockerfile:24
--------------------
  23 |     
  24 | >>> RUN pip install --no-cache-dir --upgrade pip && \
  25 | >>>     if [ ${ARCH} = "cpu" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi && \
  26 | >>>     pip install --no-cache-dir -r /home/user/comps/reranks/requirements.txt
  27 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install --no-cache-dir --upgrade pip &&     if [ ${ARCH} = \"cpu\" ]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi &&     pip install --no-cache-dir -r /home/user/comps/reranks/requirements.txt" did not complete successfully: exit code: 1
daisy-ycguo commented 5 months ago

Hi,

I cannot reproduce but I noticed the error in your log was RuntimeError: Unsupported compiler -- at least C++11 support is needed!. It indicates that the compiler used during the Docker build process does not support C++11 or later. This can occur if the default compiler on your Mac is outdated or incorrectly configured.

Will you check if you have an appropriate version of g++ or clang installed on your Mac that supports C++11?

g++ --version

or

clang --version

g++ 4.8 or later, clang 3.3 or later are good version to support C++11.

If they are old version, please upgrade either of them.

Regards Daisy

hshen14 commented 5 months ago

Mac is not yet in OPEA support list. It would be super interesting to add Mac support in OPEA roadmap.

arun-gupta commented 5 months ago

Mac is a common developer platform so adding to the supported roadmap would be very useful.

arun-gupta commented 4 months ago

@daisy-ycguo Here is what I see on my platform:

%g++ --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

What needs to be different?