El Capitan(Mac OSX 10.11.1)에 Scrapy 설치중 발생한 에러와 해결책

웹 크롤러 Scrapy를 설치하는 중 아래와 같은 에러가 발생했다

Detected a distutils installed project ('six') which we cannot uninstall. The metadata provided by distutils does not contain a list of files which have been installed, so pip does not know which files to uninstall.


1. 약간의 구글링 결과 pip 버전의 문제라는 의견이 있어 업그레이드 해 봤다.

sudo -H pip install --upgrade pip

우선 기존과 같은 문제는 사라졌지만 다른 문제가 발생했다.

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 725, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 752, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 266, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)

OSError: [Errno 1] Operation not permitted: '/tmp/pip-fk1Ads-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

구글링 결과 OSX는 El Capitan부터 일부 컴포넌트들이 이미 OS레벨에서 설치되어 공급되며 더불어 SIP(System Integrity Protection)가 적용돼 sudo로 root 작업을 수행하더라도 그 권한에 제약이 있다는 정보를 얻었다.

2. pip대신 easy_install을 사용하자

easy_install을 사용해 six를 업그레이드한 뒤 six를 제외해 scrapy를 설치하니 문제 없이 설치 되었다. easy_install은 패키지 트래킹 등 여러 이슈들 때문에 최근 들어 권장하지 않는 추세인듯 하지만 별 수 없으니 사용하기로 했다.
(왜 pip는 안되고 easy_install은 되는지 모르겠다..)

자세한 커맨드는 아래와 같다.

MacBook-Pro:~ Jeong$ sudo easy_install -U six
MacBook-Pro:~ Jeong$ sudo -H pip install scrapy --ignore-installed six

댓글

이 블로그의 인기 게시물

Unity에서 모델의 폴리곤의 반대편이 랜더링 되지 않는 문제 해결 방법

Use FFMPEG in XCode(for MacOS)