New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with spherical harmonics computations on some Anaconda python versions #852

Closed
grlee77 opened this Issue Jan 29, 2016 · 6 comments

Comments

Projects
None yet
5 participants
@grlee77
Contributor

grlee77 commented Jan 29, 2016

I am unable to run CSD models in Python 3.4 that were working fine for Python 2.7. In both cases I am at numpy 1.10.2, scipy 0.16.1 on 64-bit linux using Anaconda.

For example, I get the following traceback from introduction_to_basic_tracking.py

  File "introduction_to_basic_tracking.py", line 153, in <module>
    csd_fit = csd_model.fit(data, mask=white_matter)
  File "/home/lee8rx/anaconda/envs/py34acc/lib/python3.4/site-packages/dipy/reconst/multi_voxel.py", line 33, in new_fit
    fit_array[ijk] = single_voxel_fit(self, data[ijk])
  File "/home/lee8rx/anaconda/envs/py34acc/lib/python3.4/site-packages/dipy/reconst/csdeconv.py", line 179, in fit
    P=self._P)
  File "/home/lee8rx/anaconda/envs/py34acc/lib/python3.4/site-packages/dipy/reconst/csdeconv.py", line 536, in csdeconv
    fodf_sh = _solve_cholesky(P, z)
  File "/home/lee8rx/anaconda/envs/py34acc/lib/python3.4/site-packages/dipy/reconst/csdeconv.py", line 403, in _solve_cholesky
    raise la.LinAlgError(msg)
numpy.linalg.linalg.LinAlgError: 4-th leading minor not positive definite

I tracked the source of the error to a bad output from scipy.special.sph_harm. If I comment out the import of sph_harm and use dipy.reconst.shm.spherical_harmonic instead, the example completes sucessfully on Python 3.4 as well.

From the discussion here (scipy/scipy#5376), it seems the problem is specific to Anaconda, so I don't think there is anything you need to fix on the dipy side, but I just wanted to give a heads up for others who may encounter this issue:

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Feb 1, 2016

Hi Gregory, thank you very much the excellent feedback on this. Our Python 3.4 bots look good http://nipy.bic.berkeley.edu/builders and our Travis bots are all green on 3.4 too. https://travis-ci.org/nipy/dipy/builds/105693106 So, I am quite positive that this is an installation/packaging issue with Anaconda thing and it will most likely resolve itself.

@arokem

This comment has been minimized.

Member

arokem commented May 6, 2016

I don't think this has been fixed yet. I'm thinking it might be nice to introspect, and if the user is on Python 3 and scipy is from conda, use the "old" version of spherical_harmonics from here: https://github.com/nipy/dipy/blob/master/dipy/reconst/shm.py#L160

Anyone know how we can tell if scipy is from conda?

arokem added a commit to arokem/dipy that referenced this issue May 24, 2016

@arokem

This comment has been minimized.

Member

arokem commented May 24, 2016

Well, I've answered my own question in #1057

@jchoude

This comment has been minimized.

Contributor

jchoude commented Oct 4, 2017

Going through old issues to find a specific one, I stumbled upon this one. Should we close it?

@skoudoro

This comment has been minimized.

Member

skoudoro commented Dec 7, 2018

+1 for closing this one

@arokem

This comment has been minimized.

Member

arokem commented Dec 7, 2018

Yep. Ideally we would get rid of the ugliness introduced in arokem@c4a113d at some point, but I think it's not quite there yet.

@arokem arokem closed this Dec 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment