Víctor
Víctor

Reputation: 1

Command "python setup.py egg_info" failed with error code 1

I'm not able to install Scrapy.py,

Every time I try

$ pip install scrapy --upgrade --ignore-installed six

I get

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/_g/j_dqtjgn1ql2mzjh5ytjckh80000gn/T/pip-build-C2LMyg/cffi

If I try

$ pip install scrapy

I get

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 311, in run
root=options.root_path,
 File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 716, in uninstall
paths_to_remove.remove(auto_confirm)
 File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
      File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 315, 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: '/var/folders/_g/j_dqtjgn1ql2mzjh5ytjckh80000gn/T/pip-2MX1Ph-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

This is a headache, can anyone help me here?

Upvotes: 0

Views: 1353

Answers (1)

jimmyzhouj
jimmyzhouj

Reputation: 19

  1. Close SIP (system Integrity Protection)
    then reboot, use command +R to enter debug mode, then select terminal:

    csrutil disable
    reboot 
    
  2. Maybe you need to change something according to your mac setting

    sudo
    C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2/libxml:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include
    

    pip install scrapy --ignore-installed six

  3. Then remove old six, install it again

    sudo rm -rf /Library/Python/2.7/site-packages/six*
    sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six*
    sudo pip install six
    
  4. Then set it back

    csrutil enable
    reboot
    

    crappy works now

Upvotes: 1

Related Questions