Bug#1087640: Work-around, test files, full error message
Hugh Pumphrey
hugh.pumphrey at gmail.com
Sat Nov 16 15:50:22 GMT 2024
Just so that my example code can be used as written I attach minimal
spreadsheets blah.xls and blah.xlsx.
I note that a work-around is to uninstall the debian package of
python3-xlrd, install python3-pip (if you do not have it already) and to do:
pip3 install --break-system-packages --user xlrd
This will (at the time of writing) install xlrd-2.0.1 , after which the line
foo=pd.read_excel("blah.xls")
works as intended.
For reference, the full error message was:
In [120]: foo=pd.read_excel("blah.xls")
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In [120], line 1
----> 1 foo=pd.read_excel("blah.xls")
File /usr/lib/python3/dist-packages/pandas/util/_decorators.py:211, in
deprecate
_kwarg.<locals>._deprecate_kwarg.<locals>.wrapper(*args, **kwargs)
209 else:
210 kwargs[new_arg_name] = new_arg_value
--> 211 return func(*args, **kwargs)
File /usr/lib/python3/dist-packages/pandas/util/_decorators.py:331, in
deprecate
_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
325 if len(args) > num_allow_args:
326 warnings.warn(
327 msg.format(arguments=_format_argument_list(allow_args)),
328 FutureWarning,
329 stacklevel=find_stack_level(),
330 )
--> 331 return func(*args, **kwargs)
File /usr/lib/python3/dist-packages/pandas/io/excel/_base.py:482, in
read_excel(
io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine,
conve
rters, true_values, false_values, skiprows, nrows, na_values,
keep_default_na, n
a_filter, verbose, parse_dates, date_parser, thousands, decimal, comment,
skipfo
oter, convert_float, mangle_dupe_cols, storage_options)
480 if not isinstance(io, ExcelFile):
481 should_close = True
--> 482 io = ExcelFile(io, storage_options=storage_options, engine=
engine)
483 elif engine and engine != io.engine:
484 raise ValueError(
485 "Engine should not be specified when passing "
486 "an ExcelFile - ExcelFile already has the engine set"
487 )
File /usr/lib/python3/dist-packages/pandas/io/excel/_base.py:1695, in
ExcelFile.
__init__(self, path_or_buffer, engine, storage_options)
1692 self.engine = engine
1693 self.storage_options = storage_options
-> 1695 self._reader = self._engines[engine](self._io, storage_options=
storage_o
ptions)
File /usr/lib/python3/dist-packages/pandas/io/excel/_xlrd.py:34, in
XlrdReader._
_init__(self, filepath_or_buffer, storage_options)
24 """
25 Reader using xlrd engine.
26
(...)
31 {storage_options}
32 """
33 err_msg = "Install xlrd >= 1.0.0 for Excel support"
---> 34 import_optional_dependency("xlrd", extra=err_msg)
35 super().__init__(filepath_or_buffer, storage_options=storage_options)
File /usr/lib/python3/dist-packages/pandas/compat/_optional.py:176, in
import_op
tional_dependency(name, extra, errors, min_version)
174 return None
175 elif errors == "raise":
--> 176 raise ImportError(msg)
178 return module
ImportError: Pandas requires version '2.0.1' or newer of 'xlrd' (version
'1.2.0'
currently installed).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20241116/eab6924e/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blah.xls
Type: application/vnd.ms-excel
Size: 5632 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20241116/eab6924e/attachment-0001.xls>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blah.xlsx
Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Size: 4852 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20241116/eab6924e/attachment-0001.xlsx>
More information about the debian-science-maintainers
mailing list