Spaces:
Build error
Build error
Long Ngo Claude Sonnet 4.6 commited on
Commit ·
4a52bb1
1
Parent(s): b1479e8
fix(docs): fix Docker example and document hnswlib C++ build requirement
Browse filesThe Docker example in proxy.md used the wrong package name and lacked
build-essential, causing install failures on slim images. hnswlib (a
core dependency) requires a C++ compiler to build from source.
- Fix proxy.md Docker example: headroom[proxy] -> headroom-ai[proxy],
add build-essential install/cleanup pattern
- Add troubleshooting entry for C++ compilation errors with solutions
for Linux and macOS environments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- docs/proxy.md +6 -1
- docs/troubleshooting.md +33 -0
docs/proxy.md
CHANGED
|
@@ -248,7 +248,12 @@ Or with Docker:
|
|
| 248 |
|
| 249 |
```dockerfile
|
| 250 |
FROM python:3.11-slim
|
| 251 |
-
RUN
|
|
|
|
|
|
|
|
|
|
| 252 |
EXPOSE 8787
|
| 253 |
CMD ["headroom", "proxy", "--host", "0.0.0.0"]
|
| 254 |
```
|
|
|
|
|
|
|
|
|
| 248 |
|
| 249 |
```dockerfile
|
| 250 |
FROM python:3.11-slim
|
| 251 |
+
RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
|
| 252 |
+
&& pip install "headroom-ai[proxy]" \
|
| 253 |
+
&& apt-get purge -y build-essential && apt-get autoremove -y \
|
| 254 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 255 |
EXPOSE 8787
|
| 256 |
CMD ["headroom", "proxy", "--host", "0.0.0.0"]
|
| 257 |
```
|
| 258 |
+
|
| 259 |
+
> **Note:** `build-essential` is required at install time because `headroom-ai` includes `hnswlib`, a C++ extension that must be compiled from source. It is removed after installation to keep the image slim.
|
docs/troubleshooting.md
CHANGED
|
@@ -219,6 +219,39 @@ client = HeadroomClient(
|
|
| 219 |
|
| 220 |
## Import/Installation Issues
|
| 221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
### "ModuleNotFoundError: No module named 'headroom'"
|
| 223 |
|
| 224 |
```bash
|
|
|
|
| 219 |
|
| 220 |
## Import/Installation Issues
|
| 221 |
|
| 222 |
+
### "pip install fails with C++ compilation error"
|
| 223 |
+
|
| 224 |
+
**Symptom**: Installation fails with an error like:
|
| 225 |
+
|
| 226 |
+
```
|
| 227 |
+
RuntimeError: Unsupported compiler -- at least C++11 support is needed!
|
| 228 |
+
ERROR: Failed building wheel for hnswlib
|
| 229 |
+
```
|
| 230 |
+
|
| 231 |
+
**Cause**: `headroom-ai` depends on `hnswlib`, a C++ extension that must be compiled from source. Slim environments (Docker slim images, minimal CI runners) lack the required build tools.
|
| 232 |
+
|
| 233 |
+
**Solutions**:
|
| 234 |
+
|
| 235 |
+
```bash
|
| 236 |
+
# Linux / Debian-based (including Docker)
|
| 237 |
+
apt-get install -y build-essential && pip install headroom-ai
|
| 238 |
+
|
| 239 |
+
# macOS (Xcode command line tools)
|
| 240 |
+
xcode-select --install && pip install headroom-ai
|
| 241 |
+
```
|
| 242 |
+
|
| 243 |
+
In a Dockerfile, install and remove build tools in one layer to keep the image slim:
|
| 244 |
+
|
| 245 |
+
```dockerfile
|
| 246 |
+
FROM python:3.11-slim
|
| 247 |
+
RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
|
| 248 |
+
&& pip install "headroom-ai[proxy]" \
|
| 249 |
+
&& apt-get purge -y build-essential && apt-get autoremove -y \
|
| 250 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 251 |
+
```
|
| 252 |
+
|
| 253 |
+
---
|
| 254 |
+
|
| 255 |
### "ModuleNotFoundError: No module named 'headroom'"
|
| 256 |
|
| 257 |
```bash
|