I am trying to build a docker image for my python flask project.
Seems like there is some issue with the below packages on which Chromadb build is dependent
- duckdb,
- hnswlib
Below are the contents of the docker file.
FROM python:3.10-slim-buster
ENV HNSWLIB_NO_NATIVE=1
RUN mkdir /app
WORKDIR /app
COPY . /app
RUN pip install --upgrade pip setuptools
RUN pip install -r requirements.txt
RUN export HNSWLIB_NO_NATIVE=1
RUN pip install chromadb
EXPOSE 5000
CMD python ./app.py
The docker build fails at "RUN pip install chromadb" with the below error pointing out "Could not build wheels for duckdb, hnswlib"-
Building wheel for hnswlib (pyproject.toml) did not run successfully.
#0 9.427 │ exit code: 1
#0 9.427 ╰─> [55 lines of output]
#0 9.427 running bdist_wheel
#0 9.427 running build
#0 9.427 running build_ext
#0 9.427 creating tmp
#0 9.427 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.10 -c /tmp/tmpohs_vaib.cpp -o tmp/tmpohs_vaib.o -std=c++14
#0 9.427 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.10 -c /tmp/tmp1os2pqqf.cpp -o tmp/tmp1os2pqqf.o -std=c++11
#0 9.427 Traceback (most recent call last):
#0 9.427 File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
#0 9.427 main()
#0 9.427 File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
#0 9.427 json_out['return_val'] = hook(**hook_input['kwargs'])
#0 9.427 File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
#0 9.427 return _build_backend().build_wheel(wheel_directory, config_settings,
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 416, in build_wheel
#0 9.427 return self._build_with_temp_dir(['bdist_wheel'], '.whl',
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
#0 9.427 self.run_setup()
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
#0 9.427 exec(code, locals())
#0 9.427 File "<string>", line 116, in <module>
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
#0 9.427 return distutils.core.setup(**attrs)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
#0 9.427 return run_commands(dist)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
#0 9.427 dist.run_commands()
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
#0 9.427 self.run_command(cmd)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command
#0 9.427 super().run_command(command)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
#0 9.427 cmd_obj.run()
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 343, in run
#0 9.427 self.run_command("build")
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
#0 9.427 self.distribution.run_command(command)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command
#0 9.427 super().run_command(command)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
#0 9.427 cmd_obj.run()
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
#0 9.427 self.run_command(cmd_name)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
#0 9.427 self.distribution.run_command(command)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command
#0 9.427 super().run_command(command)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
#0 9.427 cmd_obj.run()
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
#0 9.427 _build_ext.run(self)
#0 9.427 File "/tmp/pip-build-env-o2mbvvt6/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
#0 9.427 self.build_extensions()
#0 9.427 File "<string>", line 103, in build_extensions
#0 9.427 File "<string>", line 70, in cpp_flag
#0 9.427 RuntimeError: Unsupported compiler -- at least C++11 support is needed!
#0 9.427 [end of output]
#0 9.427
#0 9.427 note: This error originates from a subprocess, and is likely not a problem with pip.
#0 9.427 ERROR: Failed building wheel for hnswlib
#0 9.428 Failed to build duckdb hnswlib
#0 9.428 ERROR: Could not build wheels for duckdb, hnswlib, which is required to install pyproject.toml-based projects
------
Dockerfile:15
--------------------
13 | RUN export HNSWLIB_NO_NATIVE=1
14 |
15 | >>> RUN pip install chromadb
16 |
17 | EXPOSE 5000
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install chromadb" did not complete successfully: exit code: 1
Could someone help please?