회사/서버 환경에서 pip install 하다가 갑자기 CMake, gcc, ArrowConfig… 같은 에러로 폭발한 적 있죠?
원인 대부분은 휠(wheel)이 없어서 소스 빌드로 빠졌기 때문입니다. 이 글은 그런 상황을 한 줄 옵션으로 피하는 방법을 정리합니다.
# 1) pip 최신화
python3 -m pip install -U pip setuptools wheel
# 2) "바이너리 휠만" 설치 강제
PIP_ONLY_BINARY=:all: python3 -m pip install --only-binary=:all: pyarrow
pip 설정/환경변수로 소스 빌드를 허용해 둔 상태pyarrow)는 C/C++ 의존이 많아 빌드가 매우 무거움 → 실패 확률 ↑--only-binary--only-binary=<패키지목록>: 지정한 패키지는 바이너리 휠만 허용--only-binary=:all:: 모든 패키지에 대해 휠만 허용PIP_ONLY_BINARY (동일한 효과)# 전부 휠만
PIP_ONLY_BINARY=:all: pip install --only-binary=:all: <패키지들>
# 특정 패키지만 휠 강제 (예: pyarrow만)
PIP_ONLY_BINARY=pyarrow pip install pyarrow
# 반대로, 전부는 소스 허용하되 특정 패키지만 휠 금지
PIP_NO_BINARY=pyarrow pip install pyarrow # (거의 안 씀)
pyarrow 안전 설치pyarrow는 소스 빌드 시 Arrow C++까지 얽혀 아주 힘듭니다. 휠만 쓰세요.
# 기본: 최신 3종 버전 순차 시도 (휠만 허용)
PY=/home/cbm/tmp/python3.11.9/bin/python3
$PY -m pip install -U pip setuptools wheel
PIP_ONLY_BINARY=:all: $PY -m pip install --only-binary=:all: "pyarrow==17.0.0" || \
PIP_ONLY_BINARY=:all: $PY -m pip install --only-binary=:all: "pyarrow==16.1.0" || \
PIP_ONLY_BINARY=:all: $PY -m pip install --only-binary=:all: "pyarrow==16.0.0"
# 확인
$PY - <<'PY'
import pyarrow as pa, numpy as np
print("pyarrow", pa.__version__)
print("numpy ", np.__version__)
PY
버전 다운그레이드는 그 버전에 휠이 존재해서 잘 깔리는 경우가 많습니다.
# 1회 설정 (전역)
pip config set global.index-url http://<내부-미러>/simple
pip config set global.trusted-host <내부-미러-호스트>
# 또는 환경변수로 일시 설정
export PIP_INDEX_URL=http://<내부-미러>/simple
export PIP_TRUSTED_HOST=<내부-미러-호스트>
외부에서 휠만 미리 다운로드 → 내부로 들여와 설치:
# 외부 PC에서 (휠만 다운로드)
pip download --only-binary=:all: -r requirements.txt -d wheels
# 내부 서버에서 (오프라인 설치)
pip install --no-index --find-links=./wheels -r requirements.txt
# bashrc / profile 등에 추가
export PIP_ONLY_BINARY=:all:
pip config set global.only-binary :all:
팀/서버 표준으로 강제하면 예상치 못한 소스 빌드를 원천 차단할 수 있음.
python3 -m pip install -U pip setuptools wheel
pip debug --verbose를 보면 현재 환경이 어떤 휠 태그를 지원하는지 나옴.pip debug --verbose | sed -n '/Compatible tags/,/End/p' | head -n 30
manylinux2014_x86_64 cp311 등이 보여야 cp311-manylinux2014_x86_64.whl을 설치 가능휠 유무 확인
해당 버전에 내 환경용 휠이 실제로 존재하는지 확인(없으면 버전 조정).
왜 소스 빌드로 갔는지 로그로 보기
pip -v install --only-binary=:all: <패키지>
Arrow/Parquet만 급하면 fastparquet로 우회:
pip install fastparquet
requirements.txt의 맨 위 줄에 옵션을 둘 수 있음.
--only-binary=:all:
pyarrow==16.1.0
pandas==2.2.3
numpy==2.3.4
이렇게 해두면 팀원이 그냥
pip install -r requirements.txt해도 휠만 설치됨.
ArrowConfig.cmake를 찾지 못함 (pyarrow 소스 빌드)CMake Error at CMakeLists.txt:... (find_package):
Could not find a package configuration file provided by "Arrow"...
→ 휠로 설치:
PIP_ONLY_BINARY=:all: pip install --only-binary=:all: pyarrow
→ 소스 빌드로 빠졌다는 신호. 휠만 설치하도록 고정하거나, 버전을 바꿔 휠이 있는 버전을 쓰rl.
--only-binary=:all:(혹은 PIP_ONLY_BINARY=:all:)로 휠만 사용하면 대부분의 지뢰를 피할 수 있음.