0

I'm really new to python and pandas so I could be making a simple mistake.

I'm trying to run the code below:

import quandl
import pandas as pd

df3 = pd.read_html('https://simple.wikipedia.org/wiki/List_of_U.S._states')
print(df3)

I have installed pandas as well quandl through pip. When I run the code I get the following error:

Traceback (most recent call last):
File "C:\Python27\FunwithQuandl.py", line 14, in <module>
df3 = pd.read_html('https://simple.wikipedia.org /wiki/List_of_U.S._states')
File "C:\Python27\lib\site-packages\pandas\io\html.py", line 874, in read_html
parse_dates, tupleize_cols, thousands, attrs, encoding)
File "C:\Python27\lib\site-packages\pandas\io\html.py", line 726, in _parse
parser = _parser_dispatch(flav)
File "C:\Python27\lib\site-packages\pandas\io\html.py", line 685, in _parser_dispatch
raise ImportError("lxml not found, please install it")
ImportError: lxml not found, please install it

I then tried installing lxml via command prompt and pip and I got a few errors:

Cannnot open include file: 'libxml/xpath.h': No such file or directory

Could not find function xmlCheckVersion in library libxm12. Is libxml2 installed?

error: command 'CL\\User\\...Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

I even tried suggestions on this from this thread:

such as

"install lxml from lfd.uci.edu/~gohlke/pythonlibs/#lxml for your python version. It's a precompiled WHL with required modules/dependencies.

The site lists several packages, when e.g. using Win32 Python 2.7, use lxml-3.6.1-cp27-cp27m-win32.whl."

I have downloaded the whl file from the site suggested but I can't seem to install it. I have tried using pip and typing out the name of the file but the file isn't being recognized via pip.

I am using Python 2.7 and Windows 7 professional

Thanks for you help.

Community
  • 1
  • 1
Moondra
  • 4,399
  • 9
  • 46
  • 104
  • When you try to install the `whl` file with pip, does it return any message? – gabra Sep 06 '16 at 22:42
  • And have you seen [this](http://stackoverflow.com/q/27885397/2029132)? – gabra Sep 06 '16 at 22:44
  • 1
    I fixed the problem. I moved the file from "Downloads" to "LocalDisk/Users/myname" when the file was in the directory of my username, PIP was able to locate it and install it for some reason. Thanks for the responses. – Moondra Sep 07 '16 at 17:04
  • 1
    That's great! Now, that you found an answer, could you write it as an answer and then tag it as the right answer. This way, other people will find the answer easily. Also, look [this](http://stackoverflow.com/help/self-answer). – gabra Sep 07 '16 at 18:44

2 Answers2

0

I fixed the problem. I moved the file that I wanted to install from Downloads to LocalDisk/Users/My_name. Inside the right directory, PIP was able to locate and install it for some reason. Thanks for the responses.

gabra
  • 9,484
  • 4
  • 29
  • 45
Moondra
  • 4,399
  • 9
  • 46
  • 104
0

I had a similar problem with configuring pandas, and the reason that for the same, I think, was that I am on a windows x64 machine, whereas my pip package was installing win32 .whl files.

I was really upset with it, until I found https://www.lfd.uci.edu/~gohlke/pythonlibs/ This is the site where I was able to get winx64 compatible modules, which I had used later with pip locally to install my packages, then the issue got resolved. (Please Note: The link provided has Python packages for Windows only).

I hope it helps.

Harshit Gupta
  • 187
  • 1
  • 11