Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Homebrew to install python on Snow Leopard.

After installing python (2.7.2), I add /usr/local/share/python to the front of my PATH. I also set PYTHONPATH to /usr/local/lib/python2.7/site-packages.

If I use pip to install lxml or feedparser, for example, then after running python, I can import lxml with no issue.

After running pip install BeautifulSoup, there exists a .egg-info directory for BeautifulSoup in the site-packages directory listed above, as well as the bs4 directory, but from BeautifulSoup import BeautifulSoup just gives me an error in the python interpreter.

sys.path is:

['', 
 '/usr/local/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg', 
 '/Users/Chris/src/python-pinboard', 
 '/usr/local/lib/python2.7/site-packages', 
 '/usr/local/Cellar/python/2.7.2/lib/python27.zip', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-darwin', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-mac', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-mac/lib-scriptpackages', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-tk', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-old', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-dynload', 
 '/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages']

Any idea what's going on?

Update: Solution Found

By default, latest BeautifulSoup, 4.0b, gets installed. Use stable release, pip install BeautifulSoup==3.2.0, and importing etc. works.

share|improve this question
    
You should probably answer your own question and accept it as the correct one. Useful for others looking at it. –  Jibran Sep 10 '11 at 10:51
    
@Jibran done; thanks. –  Chris Poole Oct 6 '11 at 13:45

2 Answers 2

up vote 1 down vote accepted

By default, latest BeautifulSoup, 4.0b, gets installed. Use stable release, pip install BeautifulSoup==3.2.0, and importing etc. works.

share|improve this answer

BeautifulSoup is now splitted into beautifulsoup (version 3..) and beautifulsoup4 (version 4..) in pip.

So to install a specific version run:

sudo pip install beautifulsoup # version 3

or

sudo pip install beautifulsoup4 # version 4
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.