Re: [clinica-forum] ImportError: cannot import name 'ImageFileError' from 'nibabel.spatialimages'

11 views
Skip to first unread message

Nicolas Gensollen

unread,
Apr 23, 2024, 3:44:48 PMApr 23
to Scott Gurney, Clinica
Hi Scott,

From a quick look at the error message you provided, I think you have a mismatch in your environment between the versions of Clinica and Nibabel.
I would recommend creating a brand new virtual environment (with conda or whatever tool you're used to working with) with a more recent version of Python (>=3.9) and the latest version of clinica (0.8.0).
This should be pretty straightforward to do, probably something like this:

$ conda create -n myEnv python=3.10
$ conda activate myEnv
$ pip install clinica

At this point, you should have clinica installed with the latest version:

$ clinica --version
clinica, version 0.8.0

Let me know if you encounter any issues in the process.
Best,
Nicolas

Le ven. 19 avr. 2024 à 17:53, Scott Gurney <scottj...@gmail.com> a écrit :
Good afternoon,

I am trying to use the clinica convert adni-to-bids function and once it finished the T1w images I get the below error.

I have previously used this process before (albeit 6months ago) without issue.
I have also tried uninstalling and reinstalling nibable, but that didnt help

Any assistance would be greatly appreciated.

Thank you, Scott

```
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py", line 1480, in create_file
    center_nifti_origin(nifti_file, output_image)
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/utils/data_handling.py", line 773, in center_nifti_origin
    from nibabel.spatialimages import ImageFileError
ImportError: cannot import name 'ImageFileError' from 'nibabel.spatialimages' (/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/nibabel/spatialimages.py)
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/bin/clinica", line 8, in <module>
    sys.exit(main())
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/cmdline.py", line 92, in main
    cli()
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids_cli.py", line 65, in cli
    adni_to_bids.convert_images(
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_to_bids.py", line 257, in convert_images
    converter(
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_modalities/adni_t1.py", line 54, in convert_adni_t1
    paths_to_bids(images, destination_dir, "t1", mod_to_update=mod_to_update)
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/clinica/iotools/converters/adni_to_bids/adni_utils.py", line 1263, in paths_to_bids
    output_file_treated = pool.map(create_file_, images_list)
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
ImportError: cannot import name 'ImageFileError' from 'nibabel.spatialimages' (/gpfs/home/tqh20wsu/.conda/envs/clinicaEnv/lib/python3.8/site-packages/nibabel/spatialimages.py)
```

--
You received this message because you are subscribed to the Google Groups "Clinica" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clinica-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clinica-user/82cbe230-cb10-4bd6-bead-a21e00e7cdc8n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages