Get Access Token for Google Analytics Embed API server side authorization
<p>I am trying to set up server side authorization for Google Analytics Embed API. When I run this on the command line:</p>

<pre><code>sudo pip install --upgrade google-api-python-client
</code></pre>

<p>I get this message:</p>

<pre><code>The directory '/Users/XXXX/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/XXXX/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 google-api-python-client
  Downloading google_api_python_client-1.5.3-py2.py3-none-any.whl (50kB)
    100% |ââââââââââââââââââââââââââââââââ| 51kB 991kB/s 
Requirement already up-to-date: httplib2&lt;1,&gt;=0.8 in /Library/Python/2.7/site-packages (from google-api-python-client)
Collecting six&lt;2,&gt;=1.6.1 (from google-api-python-client)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting uritemplate&lt;1,&gt;=0.6 (from google-api-python-client)
  Downloading uritemplate-0.6.tar.gz
Collecting oauth2client&lt;4.0.0,&gt;=1.5.0 (from google-api-python-client)
  Downloading oauth2client-3.0.0.tar.gz (77kB)
    100% |ââââââââââââââââââââââââââââââââ| 81kB 2.5MB/s 
Collecting simplejson&gt;=2.5.0 (from uritemplate&lt;1,&gt;=0.6-&gt;google-api-python-client)
  Downloading simplejson-3.8.2-cp27-cp27m-macosx_10_9_x86_64.whl (67kB)
    100% |ââââââââââââââââââââââââââââââââ| 71kB 6.8MB/s 
Collecting pyasn1&gt;=0.1.7 (from oauth2client&lt;4.0.0,&gt;=1.5.0-&gt;google-api-python-client)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Collecting pyasn1-modules&gt;=0.0.5 (from oauth2client&lt;4.0.0,&gt;=1.5.0-&gt;google-api-python-client)
  Downloading pyasn1_modules-0.0.8-py2.py3-none-any.whl
Collecting rsa&gt;=3.1.4 (from oauth2client&lt;4.0.0,&gt;=1.5.0-&gt;google-api-python-client)
  Downloading rsa-3.4.2-py2.py3-none-any.whl (46kB)
    100% |ââââââââââââââââââââââââââââââââ| 51kB 6.1MB/s 
Installing collected packages: six, simplejson, uritemplate, pyasn1, pyasn1-modules, rsa, oauth2client, google-api-python-client
  Found existing installation: six 1.4.1
    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/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 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-yzJYPo-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
</code></pre>

<p>I am logged in as the admin. I have doubled checked permissions on the directories and parent directories. I am not sure what am I doing wrong?</p>

<p>I think you might want to read this :
<a href="https://github.com/pypa/pip/issues/3165" rel="nofollow">https://github.com/pypa/pip/issues/3165</a></p>

<p>they say that you could do :</p>

<p>sudo pip install --ignore-installed six</p>

<p>sudo pip install --ignore-installed --upgrade google-api-python-client </p>

<p>Let me know if it helps,</p>

<p>Eric Lafontaine</p>

python command-line google-analytics sudo