Ipython: File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree raise Error, errors

Created on 1 Mar 2017  ยท  1Comment  ยท  Source: ipython/ipython

I get this error installing ipython in OSX, please suggest fixes:

sudo pip install ipython                      ๎‚ฒ 01:17:53 AM
The directory '/Users/mona/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/mona/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting ipython
  Downloading ipython-5.3.0-py2-none-any.whl (750kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 757kB 1.3MB/s
Requirement already satisfied: pygments in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: pexpect; sys_platform != "win32" in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: backports.shutil-get-terminal-size; python_version == "2.7" in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: simplegeneric>0.8 in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: traitlets>=4.2 in /Library/Python/2.7/site-packages (from ipython)
Collecting setuptools>=18.5 (from ipython)
  Downloading setuptools-34.3.0-py2.py3-none-any.whl (389kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 399kB 1.8MB/s
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython)
  Downloading pathlib2-2.2.1-py2.py3-none-any.whl
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: decorator in /Library/Python/2.7/site-packages (from ipython)
Collecting pickleshare (from ipython)
  Downloading pickleshare-0.7.4-py2.py3-none-any.whl
Collecting appnope; sys_platform == "darwin" (from ipython)
  Downloading appnope-0.1.0-py2.py3-none-any.whl
Requirement already satisfied: ptyprocess>=0.5 in /Library/Python/2.7/site-packages (from pexpect; sys_platform != "win32"->ipython)
Requirement already satisfied: enum34; python_version == "2.7" in /Library/Python/2.7/site-packages (from traitlets>=4.2->ipython)
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from traitlets>=4.2->ipython)
Requirement already satisfied: ipython-genutils in /Library/Python/2.7/site-packages (from traitlets>=4.2->ipython)
Requirement already satisfied: appdirs>=1.4.0 in /Library/Python/2.7/site-packages (from setuptools>=18.5->ipython)
Requirement already satisfied: packaging>=16.8 in /Library/Python/2.7/site-packages (from setuptools>=18.5->ipython)
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython)
  Downloading scandir-1.5.tar.gz
Requirement already satisfied: wcwidth in /Library/Python/2.7/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already satisfied: pyparsing in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from packaging>=16.8->setuptools>=18.5->ipython)
Installing collected packages: setuptools, scandir, pathlib2, pickleshare, appnope, ipython
  Found existing installation: setuptools 1.1.6
    Uninstalling setuptools-1.1.6:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, 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 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-gSq_qN-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

Some information:
```
~ ๎‚ฐ ๎‚  progress โœš ๎‚ฐ which python ๎‚ฒ โžถ 2 ๎‚ฒ 01:18:12 AM
/usr/bin/python
~ ๎‚ฐ ๎‚  progress โœš ๎‚ฐ which pip ๎‚ฒ 01:20:09 AM
/usr/local/bin/pip
~ ๎‚ฐ ๎‚  progress โœš ๎‚ฐ pip -V ๎‚ฒ 01:20:11 AM
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
~ ๎‚ฐ ๎‚  progress โœš ๎‚ฐ uname -a ๎‚ฒ 01:20:16 AM
Darwin Monas-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

also I tried a solution I saw in SE but no help:

~ ๎‚ฐ ๎‚  progress โœš ๎‚ฐ ls -lO /System/Library/Frameworks/Python.framework/Versions/2.7/ ๎‚ฒ 01:37:59 AM
total 2504
drwxr-xr-x 4 root wheel restricted 136 Jul 8 2016 Extras
lrwxr-xr-x 1 root wheel restricted 17 Aug 1 2016 Headers -> include/python2.7
drwxr-xr-x 3 root wheel restricted 102 Oct 23 2015 Mac
-rwxr-xr-x 1 root wheel restricted,compressed 2633024 Jul 8 2016 Python
drwxr-xr-x 6 root wheel restricted 204 Jul 8 2016 Resources
drwxr-xr-x 3 root wheel restricted 102 Oct 23 2015 _CodeSignature
drwxr-xr-x 24 root wheel restricted 816 Aug 1 2016 bin
drwxr-xr-x 3 root wheel restricted 102 Oct 23 2015 include
drwxr-xr-x 5 root wheel restricted 170 Aug 1 2016 lib
~ ๎‚ฐ ๎‚  progress โœš ๎‚ฐ csrutil status ๎‚ฒ 01:39:53 AM
System Integrity Protection status: enabled.
~ ๎‚ฐ ๎‚  progress โœš ๎‚ฐ pip install --user ipython ๎‚ฒ 01:40:02 AM
Collecting ipython
Using cached ipython-5.3.0-py2-none-any.whl
Requirement already satisfied: pygments in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: pexpect; sys_platform != "win32" in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: backports.shutil-get-terminal-size; python_version == "2.7" in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: simplegeneric>0.8 in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: traitlets>=4.2 in /Library/Python/2.7/site-packages (from ipython)
Collecting setuptools>=18.5 (from ipython)
Using cached setuptools-34.3.0-py2.py3-none-any.whl
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython)
Using cached pathlib2-2.2.1-py2.py3-none-any.whl
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: decorator in /Library/Python/2.7/site-packages (from ipython)
Collecting pickleshare (from ipython)
Using cached pickleshare-0.7.4-py2.py3-none-any.whl
Collecting appnope; sys_platform == "darwin" (from ipython)
Using cached appnope-0.1.0-py2.py3-none-any.whl
Requirement already satisfied: ptyprocess>=0.5 in /Library/Python/2.7/site-packages (from pexpect; sys_platform != "win32"->ipython)
Requirement already satisfied: enum34; python_version == "2.7" in /Library/Python/2.7/site-packages (from traitlets>=4.2->ipython)
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from traitlets>=4.2->ipython)
Requirement already satisfied: ipython-genutils in /Library/Python/2.7/site-packages (from traitlets>=4.2->ipython)
Requirement already satisfied: appdirs>=1.4.0 in /Library/Python/2.7/site-packages (from setuptools>=18.5->ipython)
Requirement already satisfied: packaging>=16.8 in /Library/Python/2.7/site-packages (from setuptools>=18.5->ipython)
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython)
Using cached scandir-1.5.tar.gz
Requirement already satisfied: wcwidth in /Library/Python/2.7/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already satisfied: pyparsing in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from packaging>=16.8->setuptools>=18.5->ipython)
Building wheels for collected packages: scandir
Running setup.py bdist_wheel for scandir ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/pip-build-TUMdXk/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/tmpksS0Gwpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.11-intel-2.7
copying scandir.py -> build/lib.macosx-10.11-intel-2.7
running build_ext
building '_scandir' extension
creating build/temp.macosx-10.11-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _scandir.c -o build/temp.macosx-10.11-intel-2.7/_scandir.o

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

error: command 'cc' failed with exit status 69


Failed building wheel for scandir
Running setup.py clean for scandir
Failed to build scandir
Installing collected packages: setuptools, scandir, pathlib2, pickleshare, appnope, ipython
Running setup.py install for scandir ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/pip-build-TUMdXk/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/pip-2ok9eF-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.11-intel-2.7
copying scandir.py -> build/lib.macosx-10.11-intel-2.7
running build_ext
building '_scandir' extension
creating build/temp.macosx-10.11-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _scandir.c -o build/temp.macosx-10.11-intel-2.7/_scandir.o

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.


error: command 'cc' failed with exit status 69

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/pip-build-TUMdXk/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/pip-2ok9eF-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /private/var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/pip-build-TUMdXk/scandir/
~ ๎‚ฐ ๎‚  progress โœš ๎‚ฐ sudo pip install --user ipython ๎‚ฒ โžถ 1 ๎‚ฒ 01:40:51 AM
Password:
The directory '/Users/mona/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/mona/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting ipython
Downloading ipython-5.3.0-py2-none-any.whl (750kB)
100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 757kB 1.0MB/s
Requirement already satisfied: pygments in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: pexpect; sys_platform != "win32" in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: backports.shutil-get-terminal-size; python_version == "2.7" in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: simplegeneric>0.8 in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: traitlets>=4.2 in /Library/Python/2.7/site-packages (from ipython)
Collecting setuptools>=18.5 (from ipython)
Downloading setuptools-34.3.0-py2.py3-none-any.whl (389kB)
100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 399kB 1.9MB/s
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython)
Downloading pathlib2-2.2.1-py2.py3-none-any.whl
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied: decorator in /Library/Python/2.7/site-packages (from ipython)
Collecting pickleshare (from ipython)
Downloading pickleshare-0.7.4-py2.py3-none-any.whl
Collecting appnope; sys_platform == "darwin" (from ipython)
Downloading appnope-0.1.0-py2.py3-none-any.whl
Requirement already satisfied: ptyprocess>=0.5 in /Library/Python/2.7/site-packages (from pexpect; sys_platform != "win32"->ipython)
Requirement already satisfied: enum34; python_version == "2.7" in /Library/Python/2.7/site-packages (from traitlets>=4.2->ipython)
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from traitlets>=4.2->ipython)
Requirement already satisfied: ipython-genutils in /Library/Python/2.7/site-packages (from traitlets>=4.2->ipython)
Requirement already satisfied: appdirs>=1.4.0 in /Library/Python/2.7/site-packages (from setuptools>=18.5->ipython)
Requirement already satisfied: packaging>=16.8 in /Library/Python/2.7/site-packages (from setuptools>=18.5->ipython)
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython)
Downloading scandir-1.5.tar.gz
Requirement already satisfied: wcwidth in /Library/Python/2.7/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already satisfied: pyparsing in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from packaging>=16.8->setuptools>=18.5->ipython)
Installing collected packages: setuptools, scandir, pathlib2, pickleshare, appnope, ipython
Running setup.py install for scandir ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-fbj7b9/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vzlvv6-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.11-intel-2.7
copying scandir.py -> build/lib.macosx-10.11-intel-2.7
running build_ext
building '_scandir' extension
creating build/temp.macosx-10.11-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _scandir.c -o build/temp.macosx-10.11-intel-2.7/_scandir.o

You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.
error: command 'cc' failed with exit status 69

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-fbj7b9/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vzlvv6-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /private/tmp/pip-build-fbj7b9/scandir/
```

Most helpful comment

*The error stems from OSX El Capitan permission system
Solved the issue by these two commands:

sudo xcodebuild -license
pip install --user ipython

>All comments

*The error stems from OSX El Capitan permission system
Solved the issue by these two commands:

sudo xcodebuild -license
pip install --user ipython
Was this page helpful?
0 / 5 - 0 ratings