daducci / COMMIT

Linear framework to combine tractography and tissue micro-structure estimation with diffusion MRI
Other
43 stars 33 forks source link

Errors in COMMIT2 tutorial #134

Closed boazkalk closed 5 months ago

boazkalk commented 5 months ago

Hi, To get to know the steps of running COMMIT2 I wanted to do the tutorial but it is giving me the following error when trying to run on the provided test dataset:

Traceback (most recent call last): File "/Users/bkalkhov/Tractography/Tractography_performance_testing/Tests/Commit2test/Demo_data/test.py", line 84, in regnorms = [commit.solvers.group_sparsity, commit.solvers.non_negative, commit.solvers.non_negative], AttributeError: module 'commit.solvers' has no attribute 'group_sparsity'

If I look into the commit.solvers it indeed does not have attribute group_sparsity but also the commit.solvers.non_negative is not there... So I changed it to commit.solvers.omega_sparse_group_lasso and .....non_negativity as they seem to be in the proximal but then I get the following error:

Traceback (most recent call last): File "/Users/bkalkhov/Tractography/Tractography_performance_testing/Tests/Commit2test/Demo_data/test.py", line 82, in prior_on_bundles = commit.solvers.init_regularisation( TypeError: init_regularisation() got an unexpected keyword argument 'regnorms'

Can you please help me figure this out?

Kind regards, Boaz

ilariagabusi commented 5 months ago

Hi @boazkalk, The documentation for COMMIT2 was not updated; we apologize for the inconvenience. Now it should be ok. You can find the latest documentation at this link.

boazkalk commented 5 months ago

Thank you so much for the extremely fast reply!

boazkalk commented 5 months ago

@ilariagabusi I have the demo working now, thank you!

I have adapted my own testdata but when I run the same script im using for the demo it gives this error:

-> Building linear operator A: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/commit/operator/operator_withLUT.c:1:10: fatal error: 'pthread.h' file not found

include

     ^~~~~~~~~~~

1 error generated. Traceback (most recent call last): File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/unixccompiler.py", line 185, in _compile self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn spawn(cmd, dry_run=self.dry_run, **kwargs) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn raise DistutilsExecError( distutils.errors.DistutilsExecError: command '/usr/local/fsl/bin/clang' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 314, in create_module so_path = build_module(spec.name, pyxfilename=spec.origin, pyxbuild_dir=self._pyxbuild_dir, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 197, in build_module so_path = pyxbuild.pyx_to_dll(pyxfilename, extension_mod, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyxbuild.py", line 103, in pyx_to_dll dist.run_commands() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/dist.py", line 963, in run_command super().run_command(command) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run self.build_extensions() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension super(build_ext, self).build_extension(ext) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension objects = self.compiler.compile( File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/ccompiler.py", line 600, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile raise CompileError(msg) distutils.errors.CompileError: command '/usr/local/fsl/bin/clang' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/bkalkhov/Tractography/Tractography_performance_testing/Tests/Commit2test/test.py", line 59, in mit.build_operator() File "commit/core.pyx", line 763, in commit.core.Evaluation.build_operator File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 332, in create_module raise exc.with_traceback(tb) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 314, in create_module so_path = build_module(spec.name, pyxfilename=spec.origin, pyxbuild_dir=self._pyxbuild_dir, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 197, in build_module so_path = pyxbuild.pyx_to_dll(pyxfilename, extension_mod, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyxbuild.py", line 103, in pyx_to_dll dist.run_commands() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/dist.py", line 963, in run_command super().run_command(command) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run self.build_extensions() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension super(build_ext, self).build_extension(ext) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension objects = self.compiler.compile( File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/ccompiler.py", line 600, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile raise CompileError(msg) ImportError: Building module commit.operator.operator failed: ["distutils.errors.CompileError: command '/usr/local/fsl/bin/clang' failed with exit code 1\n"]

Which is kind of weird as only the data changes and not the python version, compiler or anything..... Do you by any chance know the problem here?

nightwnvol commented 5 months ago

@boazkalk I believe the issue here is that your system is attempting to compile the commit.operator.operator module using the clang compiler provided by your FSL installation, which lacks some required libraries, instead of using the default clang compiler installed on your system.

It's likely that the FSL installation added the /usr/local/fsl/bin folder at the beginning of the PATH env variable in your configuration file (e.g., .bash_profile or .zprofile), leading the system to use the incorrect clang compiler. You can check this by running clang++ -v.

If so, you can try removing the /usr/local/fsl/bin entry from the PATH variable.

boazkalk commented 5 months ago

Thank you I changed it and it works!