Skip to content

Module xlrd is not installed with 0.14; creates an Import Error when using read_excel #8515

Closed
@spearsem

Description

@spearsem

After doing

conda create -n dummy_python python=2.7 pandas=0.14 ipython=2.0

and then activating dummy_python, I get the following error with a simple .xlsx file that has 3 sheets:

In [4]: pandas.read_excel('candidate_test.xlsx', sheetname='prices')
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-ad7ce8e2fc77> in <module>()
----> 1 pandas.read_excel('candidate_test.xlsx', sheetname='prices')

/home/ely/anaconda/envs/dummy_python/lib/python2.7/site-packages/pandas/io/excel.pyc in read_excel(io, sheetname, **kwds)
    111     engine = kwds.pop('engine', None)
    112 
--> 113     return ExcelFile(io, engine=engine).parse(sheetname=sheetname, **kwds)
    114 
    115 

/home/ely/anaconda/envs/dummy_python/lib/python2.7/site-packages/pandas/io/excel.pyc in __init__(self, io, **kwds)
    129     def __init__(self, io, **kwds):
    130 
--> 131         import xlrd  # throw an ImportError if we need to
    132 
    133         ver = tuple(map(int, xlrd.__VERSION__.split(".")[:2]))

ImportError: No module named xlrd

But with pandas 0.13.1, the same sheet parses with no error from the same command:

In [2]: pandas.version.version
Out[2]: '0.13.0'

In [3]: pandas.read_excel('candidate_test.xlsx', sheetname='prices')
Out[3]: 
          date      time         millis      bid    offer
0   2012.09.30  22:00:15  1349042415003  1.28490  1.28495
1   2012.09.30  22:00:16  1349042416203  1.28485  1.28495
2   2012.09.30  22:00:18  1349042418302  1.28480  1.28495
3   2012.09.30  22:03:37  1349042617304  1.28480  1.28500
4   2012.09.30  22:05:17  1349042717103  1.28485  1.28500
5   2012.09.30  22:06:05  1349042765403  1.28490  1.28500
6   2012.09.30  22:06:06  1349042766404  1.28495  1.28500
7   2012.09.30  22:06:53  1349042812903  1.28495  1.28505
8   2012.09.30  22:06:53  1349042813004  1.28495  1.28500
9   2012.09.30  22:07:59  1349042879103  1.28485  1.28500
10  2012.09.30  22:08:03  1349042882703  1.28490  1.28500
11  2012.09.30  22:08:04  1349042883903  1.28495  1.28500
12  2012.09.30  22:08:05  1349042885304  1.28485  1.28490
13  2012.09.30  22:08:07  1349042886503  1.28480  1.28490
14  2012.09.30  22:08:13  1349042892702  1.28480  1.28485
15  2012.09.30  22:08:20  1349042900103  1.28475  1.28485
16  2012.09.30  22:08:20  1349042900204  1.28475  1.28480
17  2012.09.30  22:08:38  1349042917604  1.28425  1.28470
18  2012.09.30  22:08:38  1349042917702  1.28460  1.28470
19  2012.09.30  22:08:38  1349042918005  1.28460  1.28480
20  2012.09.30  22:08:39  1349042919103  1.28425  1.28480
21  2012.09.30  22:08:39  1349042919202  1.28450  1.28480
22  2012.09.30  22:08:40  1349042919503  1.28440  1.28480
23  2012.09.30  22:08:49  1349042928702  1.28440  1.28485
24  2012.09.30  22:08:49  1349042929003  1.28440  1.28480
25  2012.09.30  22:10:12  1349043011803  1.28440  1.28475
26  2012.09.30  22:10:12  1349043012004  1.28440  1.28480
27  2012.09.30  22:10:17  1349043017204  1.28440  1.28465
28  2012.09.30  22:11:37  1349043096604  1.28440  1.28450
29  2012.09.30  22:11:40  1349043099503  1.28430  1.28440
30  2012.09.30  22:11:40  1349043099604  1.28430  1.28465
31  2012.09.30  22:11:46  1349043105703  1.28430  1.28440
32  2012.09.30  22:11:46  1349043106105  1.28430  1.28465
33  2012.09.30  22:12:58  1349043178004  1.28430  1.28460
34  2012.09.30  22:13:13  1349043192503  1.28430  1.28465
35  2012.09.30  22:13:40  1349043220003  1.28425  1.28465
36  2012.09.30  22:13:43  1349043222903  1.28430  1.28465
37  2012.09.30  22:15:32  1349043331903  1.28460  1.28465
38  2012.09.30  22:15:34  1349043334303  1.28440  1.28465
39  2012.09.30  22:15:35  1349043334503  1.28430  1.28465
40  2012.09.30  22:15:35  1349043334603  1.28460  1.28465
41  2012.09.30  22:15:36  1349043335902  1.28425  1.28465
42  2012.09.30  22:15:36  1349043336004  1.28440  1.28465
43  2012.09.30  22:15:38  1349043337703  1.28440  1.28460
44  2012.09.30  22:15:38  1349043337803  1.28425  1.28460
45  2012.09.30  22:15:38  1349043337902  1.28430  1.28460
46  2012.09.30  22:15:40  1349043339603  1.28430  1.28465
47  2012.09.30  22:15:55  1349043354903  1.28470  1.28485
48  2012.09.30  22:15:57  1349043356702  1.28450  1.28485
49  2012.09.30  22:16:57  1349043417003  1.28450  1.28480
50  2012.09.30  22:17:09  1349043429302  1.28450  1.28475
51  2012.09.30  22:17:17  1349043436702  1.28425  1.28475
52  2012.09.30  22:17:17  1349043436802  1.28440  1.28475
53  2012.09.30  22:17:23  1349043442802  1.28470  1.28475
54  2012.09.30  22:17:24  1349043443702  1.28425  1.28475
55  2012.09.30  22:17:24  1349043443803  1.28450  1.28475
56  2012.09.30  22:17:48  1349043468303  1.28425  1.28475
57  2012.09.30  22:17:48  1349043468404  1.28440  1.28475
58  2012.09.30  22:17:57  1349043476904  1.28450  1.28475
59  2012.09.30  22:18:10  1349043490303  1.28450  1.28465
           ...       ...            ...      ...      ...

[34650 rows x 5 columns]

So the question is, why was a dependency on XLRD introduced, but the library is not installed as a dependency when pandas is installed through conda?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions