2

I've run pip install pandas and seemed to get a ton of warnings but by the end everything seemed to have installed successfully. I've also run pip install requests.

When I call a function with this line:

getTeamRoster("http://modules.ussquash.com/ssm/pages/leagues/Team_Information.asp?id=11325")

I get this error (seems not to like the read_html call and wants me to install lxml?):

Traceback (most recent call last):
  File "SquashScraper.py", line 51, in <module>
    main()
  File "SquashScraper.py", line 48, in main
    getTeamRoster("http://modules.ussquash.com/ssm/pages/leagues/Team_Information.asp?id=11325")
  File "SquashScraper.py", line 39, in getTeamRoster
    tables = pd.read_html(requests.get(teamURL).content)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pandas/io/html.py", line 865, in read_html
    parse_dates, tupleize_cols, thousands, attrs, encoding)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pandas/io/html.py", line 718, in _parse
    parser = _parser_dispatch(flav)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pandas/io/html.py", line 677, in _parser_dispatch
    raise ImportError("lxml not found, please install it")
ImportError: lxml not found, please install it

Any ideas what's going on here?

Happy to provide more info if needed.

Thanks, bclayman

Edit to add:

pip install got me:

error: command '/usr/bin/clang' failed with exit status 1 Command /usr/local/bin/python3 -c "import setuptools, tokenize;__file__='/private/var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip_bu‌​ild_ben/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip-fn3n3u-record/install-recor‌​d.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip_build_ben/lxml 
4
  • 1
    read the last line: lxml not found, please install it. Commented Jun 2, 2015 at 21:53
  • try sudo apt-get install python-lxml Commented Jun 2, 2015 at 21:54
  • pip install got me: error: command '/usr/bin/clang' failed with exit status 1 Command /usr/local/bin/python3 -c "import setuptools, tokenize;__file__='/private/var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip_build_ben/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip-fn3n3u-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/m_/v2nkdbd935l6zwky8jm1g68r0000gn/T/pip_build_ben/lxml Commented Jun 2, 2015 at 21:56
  • @bshuster13 i don't have apt-get (apparently) :( Commented Jun 2, 2015 at 21:57

2 Answers 2

3

Notice that you get the following error message:

ImportError: lxml not found, please install it

That means you need to install python-lxml package on Linux.

on Ubuntu

sudo apt-get -y install python-lxml

On Fedora

sudo yum -y install python-lxml

On Mac

brew install libxml2
brew install libxslt
STATIC_DEPS=true sudo pip install lxml
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, I'm on a mac so tried with pip and got the error I commented above :(
do you have clang installed? check it with which clang, what is the output?
output is "/usr/bin/clang"
am using python 3 fwiw
0

If you're on a Mac, you have to download and install the developer tools, which can be achieved with this command:

xcode-select --install

I had the same error before doing so when I did pip install lxml

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.