pip install -r requirements.txt
fails with the exception below OSError: [Errno 13] Permission denied: \'/usr/local/lib/...
. What\'s wrong and how d
So, I got this same exact error for a completely different reason. Due to a totally separate, but known Homebrew + pip bug, I had followed this workaround listed on Google Cloud's help docs, where you create a .pydistutils.cfg file in your home directory. This file has special config that you're only supposed to use for your install of certain libraries. I should have removed that disutils.cfg file after installing the packages, but I forgot to do so. So the fix for me was actually just...
rm ~/.pydistutils.cfg
.
And then everything worked as normal. Of course, if you have some config in that file for a real reason, then you won't want to just straight rm that file. But in case anyone else did that workaround, and forgot to remove that file, this did the trick for me!
It is due permission problem,
sudo chown -R $USER /path to your python installed directory
/usr/local/lib/python2.7/
or try,
pip install --user -r package_name
and then say, pip install -r requirements.txt
this will install inside your env
dont say, sudo pip install -r requirements.txt
this is will install into arbitrary python path.