easily troubleshoot easy_install on mac
A friend was having trouble installing Beautiful SoupĀ (a python library for web crawling) usingĀ pip install beautifulsoup4 (mainly because he didnāt have pip installed and could not install pip using easy_install for some reason). In these situations itās often easier to remove old installs and start fresh.Ā Below I show how to remove old easy_install scripts, reinstall it, and then install pip to ultimately get the Beautiful Soup python package (on a mac).Ā
Hereās the error message he was getting. The solution Iām providing is down below.Ā
pip install beautifulsoup4
-bash: pip: command not found
easy_install beautifulsoup4
Traceback (most recent call last):
Ā File "/usr/local/bin/easy_install", line 5, in <module>
Ā Ā from pkg_resources import load_entry_point
Ā File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2793, in <module>
Ā Ā working_set.require(__requires__)
Ā File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 673, in require
Ā Ā needed = self.resolve(parse_requirements(requirements))
Ā File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
Ā Ā raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.10
To resolve this, first remove old easy_install scripts from the following directoriesĀ
sudo rm -f /usr/bin/easy_install*
sudo rm -f /usr/local/bin/easy_install*
Then download and run the distribute_setup.pyĀ
curl -O https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py
sudo python distribute_setup.py
sudo rm distribute_setup.py
And finally, install Beautiful Soup
pip install beautifulsoup4