CERN Accelerating science

A small issue with Swan and Excel file reading

Dear All,
I am using a Notebook on Swan using the latest software stack.
I am using the following command

SPS_cycle = pnd.read_excel(’/eos/project/m/mte/analysis/CPS/2017/Advancing_MTE_towards_HI_frontier/SPS_MTE_cycle_momentum_current.xlsx’, header = None, names = [‘timeM’, ‘momentum’, ‘timeI’, ‘current’])
momentum = SPS_cycle[[‘timeM’, ‘momentum’]].iloc[:-867]

to read in an Excel file. While such a command was working fine in the past, today I got the following error message

ImportErrorTraceback (most recent call last)
in ()
----> 1 SPS_cycle = pnd.read_excel(’/eos/project/m/mte/analysis/CPS/2017/Advancing_MTE_towards_HI_frontier/SPS_MTE_cycle_momentum_current.xlsx’, header = None, names = [‘timeM’, ‘momentum’, ‘timeI’, ‘current’])
2 momentum = SPS_cycle[[‘timeM’, ‘momentum’]].iloc[:-867]

/cvmfs/sft.cern.ch/lcg/views/LCG_95a/x86_64-centos7-gcc7-opt/lib/python2.7/site-packages/pandas/util/_decorators.pyc in wrapper(*args, **kwargs)
176 else:
177 kwargs[new_arg_name] = new_arg_value
–> 178 return func(*args, **kwargs)
179 return wrapper
180 return _deprecate_kwarg

/cvmfs/sft.cern.ch/lcg/views/LCG_95a/x86_64-centos7-gcc7-opt/lib/python2.7/site-packages/pandas/util/_decorators.pyc in wrapper(*args, **kwargs)
176 else:
177 kwargs[new_arg_name] = new_arg_value
–> 178 return func(*args, **kwargs)
179 return wrapper
180 return _deprecate_kwarg

/cvmfs/sft.cern.ch/lcg/views/LCG_95a/x86_64-centos7-gcc7-opt/lib/python2.7/site-packages/pandas/io/excel.pyc in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, **kwds)
305
306 if not isinstance(io, ExcelFile):
–> 307 io = ExcelFile(io, engine=engine)
308
309 return io.parse(

/cvmfs/sft.cern.ch/lcg/views/LCG_95a/x86_64-centos7-gcc7-opt/lib/python2.7/site-packages/pandas/io/excel.pyc in init(self, io, **kwds)
352 import xlrd
353 except ImportError:
–> 354 raise ImportError(err_msg)
355 else:
356 ver = tuple(map(int, xlrd.VERSION.split(".")[:2]))

ImportError: Install xlrd >= 0.9.0 for Excel support

I guess that the useful information is the last line of the message: how should I install xlrd under Swan?

Thanks a lot in advance for your help!

Dear Massimo,

Please go to SWAN, and above notebook click on “…” -> “Help”

In the HELP find:
Advanced setup -> Install packages in CERNBox

This will allow you to install any package you want.

We can probably include the xlrd in CVMFS releases - to be discussed @etejedor

@giovanno was this the solution, on something more is missing except that package?

Dear Piotr,

I tried to issue the command pip intall –user lxrd on a Swan terminal and the following is the error I got:

Could not find a version that satisfies the requirement lxrd (from versions: )

No matching distribution found for lxrd

You are using pip version 10.0.1, however version 19.1.1 is available.

You should consider upgrading via the ‘pip install --upgrade pip’ command.

Do you have any idea about a possible solution?

                                            Thanks a lot in advance. Cheers
                                                            Massimo

Ciao Massimo,
I imagine it is “xlrd” rather than “lxrd” :wink:
Andrea

Shame on me!
Thanks Andrea: I could install the package…

1 Like