Closed stebo85 closed 9 months ago
@stebo85 Hi~, this may be because there are relatively new packages in the installation package and there are compatibility issues during operation. You can try running with --parallel_scheduling off and --verbose to get more error related information.
Dear @weiwei2027,
The first error was caused by the source code assuming that the model is the same directory as the code. The next error seems to be related to a too new nibabel version:
[INFO] 2023-12-11 00:50:25 PID: 24 pipeline.py ------------------------Generate surf/?h.orig file--------------------------------
Traceback (most recent call last):
File "levelset2surf.py", line 106, in <module>
levelset2surf(fastcsr_subjects_dir, subj, hemi, suffix)
File "levelset2surf.py", line 57, in levelset2surf
tc_ret = nighres.shape.topology_correction(img, 'signed_distance_function',
File "/usr/local/lib/python3.8/dist-packages/nighres/shape/topology_correction.py", line 109, in topology_correction
data = img.get_data()
File "/usr/local/lib/python3.8/dist-packages/nibabel/deprecator.py", line 208, in deprecated_func
raise exception(message)
nibabel.deprecator.ExpiredDeprecationError: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).
* deprecated from version: 3.0
* Raises <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 5.0
[ERROR] 2023-12-11 00:50:43 PID: 24 pipeline.py Surface generation failed.
I am trying to downgrade nibabel and see if I can get past that. It would have helped a lot if you had provided a proper dockerfile that allows building the correct container with correct version or a docker image in the registry ...
Dear @weiwei2027,
I tried downgrading nibabel to the version you seemed to have used, but this collides with numpy again:
pipeline.py --sd ./data --sid sub-001 --t1 ./data/sub-001.nii.gz --parallel_scheduling off --verbose
Traceback (most recent call last):
File "pipeline.py", line 13, in <module>
import ants
File "/usr/local/lib/python3.8/dist-packages/ants/__init__.py", line 7, in <module>
from .core import *
File "/usr/local/lib/python3.8/dist-packages/ants/core/__init__.py", line 2, in <module>
from .ants_image import *
File "/usr/local/lib/python3.8/dist-packages/ants/core/ants_image.py", line 29, in <module>
from .. import registration, segmentation, utils, viz
File "/usr/local/lib/python3.8/dist-packages/ants/registration/__init__.py", line 3, in <module>
from .affine_initializer import *
File "/usr/local/lib/python3.8/dist-packages/ants/registration/affine_initializer.py", line 7, in <module>
from .. import utils
File "/usr/local/lib/python3.8/dist-packages/ants/utils/__init__.py", line 5, in <module>
from .convert_nibabel import *
File "/usr/local/lib/python3.8/dist-packages/ants/utils/convert_nibabel.py", line 6, in <module>
import nibabel as nib
File "/usr/local/lib/python3.8/dist-packages/nibabel/__init__.py", line 65, in <module>
from . import nifti1 as ni1
File "/usr/local/lib/python3.8/dist-packages/nibabel/nifti1.py", line 26, in <module>
from .quaternions import fillpositive, quat2mat, mat2quat
File "/usr/local/lib/python3.8/dist-packages/nibabel/quaternions.py", line 31, in <module>
MAX_FLOAT = np.maximum_sctype(np.float)
File "/usr/local/lib/python3.8/dist-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
can you post which versions of packages you originally used?
@stebo85 Thanks for your feedback. It seems that providing a requirements.txt file is very necessary. Now I recommend that you lower the numpy version to 1.20 or 1.19. Ignore the warning from pip that nighres requires a lower version of numpy.
@weiwei2027 ,
yes, a requirements file would be useful - or fixing package versions in your docker file. I downgraded numpy to 1.19.5, but no success:
python3 pipeline.py --sd ./data --sid sub-001 --t1 ./data/sub-001.nii.gz --parallel_scheduling off --verbose
Traceback (most recent call last):
File "pipeline.py", line 13, in <module>
import ants
File "/usr/local/lib/python3.8/dist-packages/ants/__init__.py", line 7, in <module>
from .core import *
File "/usr/local/lib/python3.8/dist-packages/ants/core/__init__.py", line 2, in <module>
from .ants_image import *
File "/usr/local/lib/python3.8/dist-packages/ants/core/ants_image.py", line 19, in <module>
import pandas as pd
File "/usr/local/lib/python3.8/dist-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401
File "/usr/local/lib/python3.8/dist-packages/pandas/compat/__init__.py", line 25, in <module>
from pandas.compat.numpy import (
File "/usr/local/lib/python3.8/dist-packages/pandas/compat/numpy/__init__.py", line 25, in <module>
raise ImportError(
ImportError: this version of pandas is incompatible with numpy < 1.20.3
your numpy version is 1.19.5.
@stebo85 so frustrating. All these problems are mainly caused by nighres being too old. New versions of other software will have various compatibility errors. Unfortunately, there is no running environment on my computer, and I cannot provide you with accurate runnable software version information. At the time this code was released, these issues did not exist, which may be a clue to downgrading the software version. Or please check the article and code first. Some parts may still be of reference value, but some parts are out of date.
Hi @stebo85, We'll update the docker and codes with updated dependencies this week. Will let you know after updating.
Hi @stebo85 , We have updated docker/Dockerfile_cpu and docker/Dockerfile_gpu. The FastCSR Docker image has been uploaded to dockerhub. The address is: https://hub.docker.com/r/ninganme/fastcsr/tags. run example: sudo docker run -it --gpus 'device=0' -v $TestDataPath:/root/data --rm ninganme/fastcsr:last --sid sub-001 --sd /root/data --optimizing_surface off
Dear @IndiLab - fantastic that works :)
I tried to run the tool on the test data provided and get this error:
this is the list of python packages installed and their versions: