OSX El Capitan: sudo pip install OSError: [Errno: 1] Operation not permitted - pip

When I run:
sudo pip install ipython
I get the following error
OSError: [Errno: 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/share'
The last command executed tries to create the directory given above.
Also, the following command fails to install iPython without providing any errors.
sudo pip install --user python
(I am on Mac OS X El Capitan in case other folks on this OS see the same issue.)

Instructions telling people to use sudo pip install are inherently wrong.
If there is any tutorial out there which says you should use sudo pip then please file a bug against this package. The author is dis-educating the Python community, as time has proven sudo pip to be a broken practice.
OSX El Capitan introduced mechanisms to prevent damaging the operating system files. /System/Library/Frameworks/Python.framework/Versions/2.7/share is one of the protected locations. A normal user has no reason to put or write any files there. This is because the operating system itself relies on these files and sudo pip, with all force given from the above, would unconditionally overwrite them. Usually bad things would not happen, but the chances are there. Apple wants to protect their OS users from accidentally bricking their installation.
Instead, you need to install a Python package, like IPython, locally to the home folder of your user. The easiest way is to create a virtual environment, activate it, and then run pip in the virtual environment.
Example:
cd ~ # Go to home directory
virtualenv my-venv
source my-venv/bin/activate
pip install IPython
More info
Official Python package installation tutorial.
How to create virtual environments.
Alternatively, one should be able to use pip install --user. But again, sudo is not needed and you need to manually set up PATH environment variable.

I had the same problems, but using the easy_install "module" solved the problem for me.
I am not sure why, but pip and easy_install use different install locations, and easy_install chose the right ones.
Edit: without re-checking but because of the comments; it seems that different (OSX and brew-installed) installations interfere with each other which is why the tools mentioned point to different locations (since they belong to different installations). I understand that usually those tools from one install point to the same folder.

You should reinstall Python:
brew reinstall python
To get brew see the brew homepage.

pip install --ignore-installed six
This will do the job, then you can try your first command.
Via http://github.com/pypa/pip/issues/3165

Used pip3 install <package> instead and solved the permission problem with pip.

TL;DR $PATH fix
Use pip install --user package_name to install a package that should include CLI executables.
Launch a python shell and import package_name
Find where lib/python/... occurs in the output and replace it all with bin
It's likely to be $HOME/Library/Python/2.7/bin
Details
Because of the new System Integrity Protection in macOS 10.11 El Capitan, you can no longer sudo pip install. We won't debate the merits of that here.
Another answer explains that you should pip install --user which is correct. But they sent you to the back alleys to figure out what to do about your $PATH so that you could get access to installed executables. Luckily, I've already solved a similar need for an unrelated question.
Here is a transcript of how I solved the problem on one of my systems. I'm including it all rather just than the $PATH that worked for me, because your system may be different from mine. This process should work for everybody.
$ pip install --user jp
Collecting jp
Downloading jp-0.2.4.tar.gz
Installing collected packages: jp
Running setup.py install for jp ... done
Successfully installed jp-0.2.4
$ python -c 'import jp; print jp'
<module 'jp' from '/Users/bbronosky/Library/Python/2.7/lib/python/site-packages/jp/__init__.pyc'>
$ find /Users/bbronosky/Library/Python -type f -perm -100
/Users/bbronosky/Library/Python/2.7/bin/jp
$ which jp
$ echo -e '\n''export PATH=$HOME/Library/Python/2.7/bin:$PATH' >> ~/.bashrc
$ bash # starting a new bash process for demo, but you should open a new terminal
$ which jp
/Users/bbronosky/Library/Python/2.7/bin/jp
$ jp
usage: jp <expression> <filepath>

Same error
Installing collected packages: six, pyparsing, packaging, appdirs, setuptools
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/six.py'
and here I use --user without sudo to solve this issue
$ pip install --user scikit-image h5py keras pygame
Collecting scikit-image
Downloading http://mirrors.aliyun.com/pypi/packages/65/69/27a1d55ce8f77c8ac757938707105b1070ff4f2ae47d2dc99461bfae4491/scikit_image-0.13.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (28.1MB)
100% |████████████████████████████████| 28.1MB 380kB/s
Collecting h5py
Downloading http://mirrors.aliyun.com/pypi/packages/b7/cc/1c29b0815b12de2c92b5323cad60f724ac8f0e39d0166d0b9dfacbcb70dd/h5py-2.7.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.5MB)
100% |████████████████████████████████| 4.5MB 503kB/s
Requirement already satisfied: keras in /Library/Python/2.7/site-packages
Requirement already satisfied: pygame in /Library/Python/2.7/site-packages
Requirement already satisfied: matplotlib>=1.3.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from scikit-image)
Requirement already satisfied: six>=1.7.3 in /Library/Python/2.7/site-packages (from scikit-image)
Requirement already satisfied: pillow>=2.1.0 in /Library/Python/2.7/site-packages (from scikit-image)
Requirement already satisfied: networkx>=1.8 in /Library/Python/2.7/site-packages (from scikit-image)
Requirement already satisfied: PyWavelets>=0.4.0 in /Library/Python/2.7/site-packages (from scikit-image)
Collecting scipy>=0.17.0 (from scikit-image)
Downloading http://mirrors.aliyun.com/pypi/packages/72/eb/d398b9f63ee936575edc62520477d6c2353ed013bacd656bd0c8bc1d0fa7/scipy-0.19.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (16.2MB)
100% |████████████████████████████████| 16.2MB 990kB/s
Requirement already satisfied: numpy>=1.7 in /Library/Python/2.7/site-packages (from h5py)
Requirement already satisfied: theano in /Library/Python/2.7/site-packages (from keras)
Requirement already satisfied: pyyaml in /Library/Python/2.7/site-packages (from keras)
Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: tornado in /Library/Python/2.7/site-packages (from matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: pyparsing>=1.5.6 in /Users/qiuwei/Library/Python/2.7/lib/python/site-packages (from matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: nose in /Library/Python/2.7/site-packages (from matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: olefile in /Library/Python/2.7/site-packages (from pillow>=2.1.0->scikit-image)
Requirement already satisfied: decorator>=3.4.0 in /Library/Python/2.7/site-packages (from networkx>=1.8->scikit-image)
Requirement already satisfied: singledispatch in /Library/Python/2.7/site-packages (from tornado->matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: certifi in /Library/Python/2.7/site-packages (from tornado->matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: backports_abc>=0.4 in /Library/Python/2.7/site-packages (from tornado->matplotlib>=1.3.1->scikit-image)
Installing collected packages: scipy, scikit-image, h5py
Successfully installed h5py-2.7.0 scikit-image-0.13.0 scipy-0.19.0
Hope it will help someone who encounter similar issue!

I had the same issues.
As others have mentioned, don't run pip install with sudo.
Run
brew doctor
and fix the warnings and you should be able to proceed with your pip install.

It is hard to get pip working on El Capitan for several reasons:
OS X doesn't set some distutils variables correctly, so pip tries to install ancillary files in locations under /System/Library/. El Capitan blocks this, which is the error you are running into.
OS X includes a number of outdated packages under /System/Library/. pip often wants to upgrade these but cannot on El Capitan.
OS X places /System/Library/ higher in the python search order than /Library/Python/2.7/site-packages (the system-wide python package location), so even if you manage to install newer versions of some packages, the old ones still get loaded, breaking some dependencies.
There are workarounds for all of these at https://apple.stackexchange.com/a/223163/143849 . But you may be best off installing your own version of Python via the standard Python installer, Homebrew or Anaconda.

I guess you have some conflict with other package. For me it was six. So you need to use a command like this:
pip install google-api-python-client --upgrade --ignore-installed six
or
pip install --ignore-installed six

I fully agree with Mikko, but if you still want to do it, here is the way:
Restart in recovery mode (Hold cmd + R)
Open terminal from utilities
Use the command csrutil disable

I have python2.7 installed via brew and the following solved my problem
brew install numpy
It installs python3, but it still works and sets it up for 2.7 as well.

Related

Can't install spacy for NLP tasks

I'm trying to install spaCy for NLP tasks but when I follow the first instruction from https://spacy.io/usage (pip install -U pip setuptools wheel) I get the error below. I believe my error may come from me creating two different users for my laptop, my lack of understanding of environment variables, virtual environments, and my path variable. I also do not understand the message about no metadata being found.
Microsoft Windows [Version 10.0.19043.1706]
(c) Microsoft Corporation. All rights reserved.
C:\Python310\Scripts>pip install -U pip setuptools wheel
Requirement already satisfied: pip in c:\users\user\appdata\roaming\python\python310\site-packages (22.0.4)
Collecting pip
Using cached pip-22.1.2-py3-none-any.whl (2.1 MB)
Requirement already satisfied: setuptools in c:\python310\lib\site-packages (62.3.2)
Requirement already satisfied: wheel in c:\python310\lib\site-packages (0.37.1)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 22.0.4
Uninstalling pip-22.0.4:
Successfully uninstalled pip-22.0.4
WARNING: No metadata found in c:\users\user\appdata\roaming\python\python310\site-packages
Rolling back uninstall of pip
Moving to c:\users\user\appdata\roaming\python\python310\scripts\pip.exe
from C:\Users\User\AppData\Local\Temp\pip-uninstall-on_65qs2\pip.exe
Moving to c:\users\user\appdata\roaming\python\python310\scripts\pip3.10.exe
from C:\Users\User\AppData\Local\Temp\pip-uninstall-on_65qs2\pip3.10.exe
Moving to c:\users\user\appdata\roaming\python\python310\scripts\pip3.exe
from C:\Users\User\AppData\Local\Temp\pip-uninstall-on_65qs2\pip3.exe
Moving to c:\users\user\appdata\roaming\python\python310\site-packages\pip-22.0.4.dist-info\
from C:\Users\User\AppData\Roaming\Python\Python310\site-packages\~ip-22.0.4.dist-info
Moving to c:\users\user\appdata\roaming\python\python310\site-packages\pip\
from C:\Users\User\AppData\Roaming\Python\Python310\site-packages\~ip
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Python310\\Lib\\site-packages\\pip\\__init__.py'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the 'C:\Python310\python.exe -m pip install --upgrade pip' command.
C:\Python310\Scripts>
Screenshot of error message

Cannot start qutebrowser, installed packages are shown as missing

I'm trying to install qutebrowser with tox and followed the instructions on this page.
However, this didn't work. When I run
python3 -m qutebrowser
I get one of the error messages
Fatal error: jinja2 is required to run qutebrowser but could not be imported! Maybe it's not installed?
The error encountered was:
No module named 'jinja2'
Please search for the python3 version of jinja2 in your distributions packages, or see https://github.com/qutebrowser/qutebrowser/blob/master/doc/install.asciidoc
If you installed a qutebrowser package for your distribution, please report this as a bug.
or the same with PyYAML/yaml instead of jinja2.
However, if I run
sudo pip install jinja2
sudo pip install pyyaml
I get
Requirement already satisfied: jinja2 in /usr/local/lib/python2.7/dist-packages (2.10.1)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib/python2.7/dist-packages (from jinja2) (0.23)
Requirement already satisfied: pyyaml in /usr/local/lib/python2.7/dist-packages (5.1)
I guess the problem may be that the installed versions are for python2.7, however I followed these instructions without change.
You followed those instructions with a change: you run python3 instead of python.
If you have both Python 2.7 and Python 3 installed to install packages for Python 3 you need to run pip3 install or python3 -m pip install.

How can I install Ansible on Raspbian?

I would like to install Ansible on my Raspberry Pi (raspbian/jessie) so that I can maintain it. Unfortunately, I don't seem to be able to install it. I've tried APT and PIP so far but each has a hurdle.
APT
pi#retropie:~ $ sudo apt-add-repository ppa:ansible/ansible
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 167, in <module>
sp = SoftwareProperties(options=options)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 105, in __init__
self.reload_sourceslist()
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 595, in reload_sourceslist
self.distro.get_sources(self.sourceslist)
File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
(self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/jessie
PIP (Python 2.7.9, pip 1.5.6)
pi#retropie:~ $ sudo pip install ansible
Downloading/unpacking ansible
Downloading ansible-2.4.1.0.tar.gz (6.7MB): 6.7MB downloaded
no previously-included directories found matching 'ticket_stubs'
no previously-included directories found matching 'hacking'
Downloading/unpacking jinja2 (from ansible)
Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB): 340kB downloaded
Downloading/unpacking PyYAML (from ansible)
Downloading PyYAML-3.12.tar.gz (253kB): 253kB downloaded
Running setup.py (path:/tmp/pip-build-bsUTB2/PyYAML/setup.py) egg_info for package PyYAML
Downloading/unpacking paramiko (from ansible)
Downloading paramiko-2.3.1-py2.py3-none-any.whl (182kB): 182kB downloaded
Downloading/unpacking cryptography (from ansible)
Downloading cryptography-2.1.2.tar.gz (441kB): 441kB downloaded
Running setup.py (path:/tmp/pip-build-bsUTB2/cryptography/setup.py) egg_info for package cryptography
error in cryptography setup command: Invalid environment marker: python_version < '3'
Complete output from command python setup.py egg_info:
error in cryptography setup command: Invalid environment marker: python_version < '3'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-bsUTB2/cryptography
Storing debug log for failure in /root/.pip/pip.log
Python 3
As you can see from the above error, "cryptography" indicates it needs > python3
I looked at the installation requirements and found that you need python 3.5+ if you use 3. Rasbian comes with 3.4...
I then tried to get python 3.6 installed using a couple of ppa's (ppa:jonathonf/python-3.6 and ppa:deadsnakes/ppa) but there aren't distros available for raspbian/jessie either.
After that I started looking at pulling down and compiling python from source but I'm expecting I'll hit another hurdle.
Ugh...
In summary, does anyone have any ideas how I can get Ansible installed on a Raspberry Pi?
Slightly old question but its the first result that comes up when googling for how to install Ansible on Raspbian so thought I'd update it. If you're running stretch (or stretch-lite)
You can just do
sudo apt-get install ansible
However currently the version of Ansbile in the Raspbian repositories is 2.2 which is a little old
Following instructions (with a little modification to overcome some errors) from the Ansible installation page you can do the following:
First run
sudo apt-get install dirmngr
Edit your /etc/apt/sources.list and append
deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main
then run
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt-get update
sudo apt-get install ansible
This will give you version 2.7.8 as of today.
Edited to include missing command (thanks SpacePope) and correct formatting.
Jessie was released in 2015 and is officially obsolete. Stretch is the current Raspbian repo, and it has python3.5 without adding PPAs.
You can then simply install Ansible with pip3.

brew or pip - install credstash - errors - No named formulae found in taps / OSErr six-1.4.1-py2.7.egg-info operation not permitted

Getting the following error on my Mac Terminal window.
$ pip --version
pip 6.1.1 from /Library/Python/2.7/site-packages (python 2.7)
Python version is 2.7.10
While trying to install credstash using brew, I'm getting the following error.
$ `which python` --version && brew update && brew install credstash
Python 2.7.10
Already up-to-date.
Error: No available formula with the name "credstash"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
Got the similar error, when I tried to install pip3 using brew.
Tried installing credstash from pip but that errored out as well.
[arun#MacBook-Pro-2 ~/aks/wspace] $ pip install credstash
You are using pip version 6.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting credstash
Using cached credstash-1.12.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.6.1 in /Library/Python/2.7/site-packages (from credstash)
Collecting boto3>=1.1.1 (from credstash)
Using cached boto3-1.4.2-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): jmespath<1.0.0,>=0.7.1 in /Library/Python/2.7/site-packages (from boto3>=1.1.1->credstash)
Collecting botocore<1.5.0,>=1.4.1 (from boto3>=1.1.1->credstash)
Using cached botocore-1.4.87-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.0 (from boto3>=1.1.1->credstash)
Using cached s3transfer-0.1.10-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached docutils-0.13.1-py2-none-any.whl
Collecting futures<4.0.0,>=2.2.0 (from s3transfer<0.2.0,>=0.1.0->boto3>=1.1.1->credstash)
Using cached futures-3.0.5-py2-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, docutils, botocore, futures, s3transfer, boto3, credstash
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/basecommand.py", line 246, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 352, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 687, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 730, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 126, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 292, 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/z5/37m4q63j3bn48y3dxgf40tdm0000gn/T/pip-LMRqSS-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
IF I don't use sudo in the above command, then I get the following exception error:
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/concurrent'
To get latest pip, as pip is provided via python on macOS, if I try to install python using brew, I'm getting the following, poking into it how I can remove Xcode first:
$ brew install python
Error: Your Xcode (5.0.2) is too outdated.
Please update to Xcode 8.2 (or delete it).
Xcode can be updated from the App Store.
$ pip --version
pip 6.1.1 from /Library/Python/2.7/site-packages (python 2.7)
As I thought I have an older pip version, I download this file:
$ wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py
Which successfully installed a newer version of pip. Now showing:
$ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
Retried doing pip install credstash but still getting the same error (with or without sudo).
I tried the following to get credstash installed.
Downloaded Python3 Mac binary from here.
https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg
Installed the .pkg file GUI way.
Opened a Terminal window in Mac.
[arun#MacBook-Pro-2 /tmp] $ which pip
/usr/local/bin/pip
[arun#MacBook-Pro-2 /tmp] $ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
[arun#MacBook-Pro-2 /tmp] $ which python
/usr/bin/python
[arun#MacBook-Pro-2 /tmp] $ python --version
Python 2.7.10
[arun#MacBook-Pro-2 /tmp] $ which python3
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
[arun#MacBook-Pro-2 /tmp] $ python3 --version
Python 3.5.2
[arun#MacBook-Pro-2 /tmp] $ which pip3
/Library/Frameworks/Python.framework/Versions/3.5/bin/pip3
[arun#MacBook-Pro-2 /tmp] $ pip3 --version
pip 8.1.1 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)
[arun#MacBook-Pro-2 /tmp] $
[arun#MacBook-Pro-2 /tmp] $ pip3 install credstash
Collecting credstash
Using cached credstash-1.12.0.tar.gz
Collecting pycrypto>=2.6.1 (from credstash)
Using cached pycrypto-2.6.1.tar.gz
Collecting boto3>=1.1.1 (from credstash)
Using cached boto3-1.4.2-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.0 (from boto3>=1.1.1->credstash)
Using cached s3transfer-0.1.10-py2.py3-none-any.whl
Collecting botocore<1.5.0,>=1.4.1 (from boto3>=1.1.1->credstash)
Using cached botocore-1.4.87-py2.py3-none-any.whl
Collecting jmespath<1.0.0,>=0.7.1 (from boto3>=1.1.1->credstash)
Using cached jmespath-0.9.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Downloading docutils-0.13.1-py3-none-any.whl (536kB)
100% |████████████████████████████████| 542kB 1.3MB/s
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: pycrypto, docutils, six, python-dateutil, jmespath, botocore, s3transfer, boto3, credstash
Running setup.py install for pycrypto ... done
Running setup.py install for credstash ... done
Successfully installed boto3-1.4.2 botocore-1.4.87 credstash-1.12.0 docutils-0.13.1 jmespath-0.9.0 pycrypto-2.6.1 python-dateutil-2.6.0 s3transfer-0.1.10 six-1.10.0
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[arun#MacBook-Pro-2 /tmp] $
[arun#MacBook-Pro-2 /tmp] $ which credstash
/Library/Frameworks/Python.framework/Versions/3.5/bin/credstash
[arun#MacBook-Pro-2 /tmp] $
If you're trying to install to system Python then you need sudo. If you want to just play around, look into creating a virtualenv and install there. http://docs.python-guide.org/en/latest/dev/virtualenvs/

How do I install a missing Python dependency that is already a system package (and detected by pip install)?

I installed Python/pip with Homebrew, then installed Pandas with pip. However, when I import Pandas, it says there is a missing dependency "pytz".
So I run
pip install pytz
But it thinks it already exists
Requirement already satisfied: pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Removing pytz does not work, when I run pip uninstall pytz, I get permission errors. How should I handle this?
For those interested: I re-installed python/pip with brew again and got this working. Even though Python and pip were in the right directory (/usr/local/bin), Pip was still looking for dependencies in /System. Pip stopped looking in /System after the reinstallation.

Resources