Please can you help me install pip? I previously had pip but somehow I broke it and I tried uninstalling python and reinstalling it but I still cannot get pip back...
sudo python get-pip.py
The directory '/Users/Name/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/Name/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. Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages
sudo -H python get-pip.py
Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages
I also tried this:
sudo easy_install pip
Traceback (most recent call last): File "/usr/bin/easy_install-2.7", line 7, in from pkg_resources import load_entry_point File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 2927, in @_call_aside File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 2913, in _call_aside f(*args, **kwargs) File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 2940, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 637, in _build_master return cls._build_from_requirements(requires) File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 650, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 829, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'setuptools==1.1.6' distribution was not found and is required by the application
Then I found that pip
is installed with python, but for some reason pip is not working.
brew install python
Warning: python 2.7.13 is already installed
pip install regex
zsh: command not found: pip
pip install --upgrade pip
zsh: command not found: pip
When I go here > cd /usr/local/lib/python2.7/site-packages && ls
I find distribute-0.6.14-py2.7.egg and pip-9.0.1.dist-info
But when I go to /usr/local/bin
I cannot find pip, only pip3:
I did try out some solutions from here but they are not working.
EDIT:
Following from the comment I tried
sudo pip install regex
Password:
sudo: pip: command not found
➜ ~ python -m pip install regex
Collecting regex
Downloading regex-2017.06.23.tar.gz (607kB)
100% |████████████████████████████████| 614kB 694kB/s
Building wheels for collected packages: regex
Running setup.py bdist_wheel for regex ... done
Stored in directory: /Users/Manal/Library/Caches/pip/wheels/aa/48/61/f321b8a521167213da5de2a65e76530e362e58e328b1d74ab3
Successfully built regex
Installing collected packages: regex
Successfully installed regex-2017.6.23
I'm not sure why it worked? How can I use pip normally?
EDIT:
Something broke I think..
➜ ~ pip install regex
zsh: command not found: pip
➜ ~
➜ ~ python -m pip install regex
Requirement already satisfied: regex in /usr/local/lib/python2.7/site-packages
➜ ~ which pip
pip not found
I dont know why which pip isnt returning anything?
EDIT:
Tried installing setup tools
➜ ~ sudo brew install python-setuptools
Password:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
➜ ~
➜ ~ brew install python-setuptools
Error: No available formula with the name "python-setuptools"
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
➜ ~
➜ ~ sudo apt-get install python-setuptools
sudo: apt-get: command not found
➜ ~
➜ ~ easy_install -U setuptools
Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 7, in
from pkg_resources import load_entry_point
File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 2927, in
@_call_aside
File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 2913, in _call_aside
f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 2940, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 637, in _build_master
return cls._build_from_requirements(requires)
File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 650, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/Library/Python/2.7/site-packages/pkg_resources/init.py", line 829, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'setuptools==1.1.6' distribution was not found and is required by the application