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

grlee77 opened this Issue Jan 29, 2016 · 6 comments


None yet
5 participants

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

  File "", line 153, in <module>
    csd_fit =, mask=white_matter)
  File "/home/lee8rx/anaconda/envs/py34acc/lib/python3.4/site-packages/dipy/reconst/", 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/", line 179, in fit
  File "/home/lee8rx/anaconda/envs/py34acc/lib/python3.4/site-packages/dipy/reconst/", line 536, in csdeconv
    fodf_sh = _solve_cholesky(P, z)
  File "/home/lee8rx/anaconda/envs/py34acc/lib/python3.4/site-packages/dipy/reconst/", 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:


This comment has been minimized.


Garyfallidis commented Feb 1, 2016

Hi Gregory, thank you very much the excellent feedback on this. Our Python 3.4 bots look good and our Travis bots are all green on 3.4 too. So, I am quite positive that this is an installation/packaging issue with Anaconda thing and it will most likely resolve itself.


This comment has been minimized.


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:

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


This comment has been minimized.


arokem commented May 24, 2016

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


This comment has been minimized.


jchoude commented Oct 4, 2017

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


This comment has been minimized.


skoudoro commented Dec 7, 2018

+1 for closing this one


This comment has been minimized.


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