XLRDError : Excel xlsx file not supported

132 views
Skip to first unread message

Itsasne Arangoa Guelbenzu

unread,
Jan 12, 2021, 4:58:57 AM1/12/21
to Clinica

Describe the bug
When using clinica convert adni-to-bids clinica crashes. The error is related to a file format issue.

The output of the command is the following:
`Creating participants.tsv...

*** Clinica crashed ***

Exception type: XLRDError
Exception value: Excel xlsx file; not supported
Below are displayed information that were gathered when Clinica crashed. This will help to understand what happened if you transfer those information to the Clinica development team.

============================================================================================================================================================
0 /home/itsasne/miniconda3/envs/clinicaEnv/bin/clinica 33 sys.exit(load_entry_point('clinica==0.3.7', 'console_scripts', 'clinica')())
1 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/clinica/cmdline.py 536 execute args.func(args)
2 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids_cli.py 56 run_command self.absolute_path(args.bids_directory))
3 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids.py 62 convert_clinical_data participants_df = bids.create_participants_df('ADNI', clinic_specs_path, clinical_data_dir, bids_ids)
4 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/clinica/iotools/bids_utils.py 38 create_participants_df participants_specs = pd.read_excel(clinical_spec_path, sheet_name='participant.tsv')
5 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/util/_decorators.py 296 wrapper return func(*args, **kwargs)
6 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_base.py 304 read_excel io = ExcelFile(io, engine=engine)
7 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_base.py 867 init self._reader = self._enginesengine
8 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py 22 init super().init(filepath_or_buffer)
9 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_base.py 353 init self.book = self.load_workbook(filepath_or_buffer)
10 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py 37 load_workbook return open_workbook(filepath_or_buffer)
11 /home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/xlrd/init.py 170 open_workbook raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')

Documentation can be found here: http://www.clinica.run/doc/
If you need support, do not hesitate to ask: https://groups.google.com/forum/#!forum/clinica-user
Alternatively, you can also open an issue on GitHub: https://github.com/aramis-lab/clinica/issues`

The error occurs in "/home/itsasne/miniconda3/envs/clinicaEnv/lib/python3.7/site-packages/xlrd/init.py", because in line 170 this condition is not fulfilled:

if file_format and file_format != 'xls': raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')

The "file format" variable is obtained from a function (inspect_format) which is located in the same script. However, this function returns "xlsx" as the format_file, instead of "xls", which causes posterior errors.

In order to get 'file_format = 'xls'', this condition must be fulfilled (and it does not):
if peek.startswith(XLS_SIGNATURE): return 'xls'

To Reproduce
Steps to reproduce the behavior:

  1. Install clinica
  2. Launch the converter
    clinica convert adni-to-bids usage: clinica convert adni-to-bids \dataset_directory \clinical_data_directory \bids_directory
  3. See error

Expected behavior
Correct conversion from adni to bids.

Desktop (please complete the following information):

  • OS: Ubuntu 64 bits (runned in Oracle VM)
  • Terminal

mauric...@inria.fr

unread,
Jan 12, 2021, 5:27:44 AM1/12/21
to Clinica
Hi,

Most recent version of Clinica (>=0.3.8) solves this problem. For more info see the repository!

Best,

Itsasne Arangoa Guelbenzu

unread,
Jan 12, 2021, 5:50:07 AM1/12/21
to Clinica
First of all I would like to thank you for the repply! I will install the new version of Clinica. Besides, I would like to ask you a question about the installation on Clinica. In the creation of the environment, the python version that should be used in the installation of the new version of clinica is 3.7 or 3.8?
Thank you in advance,  

2021(e)ko urtarrilakren 12(a), asteartea (11:27:44 (UTC+1)); mauric...@inria.fr erabiltzaileak hau idatzi zuen:
Reply all
Reply to author
Forward
0 new messages