scipy: ConvexHull Segfault on OSX with XCode 9.4.1
scikit-image is hitting a segfault using ConvexHull with modern versions of scipy on OSX. You can see a build that calls a short script: https://travis-ci.org/scikit-image/scikit-image/jobs/488320442 A build of https://github.com/scikit-image/scikit-image/pull/3712
/Users/travis/venv/bin/python
Python 3.7.1
     numpy   1.16.1
     scipy   1.2.0
matplotlib   3.0.2
       six   1.12.0
 PIL.Image   1.1.7
  networkx   2.2
    Cython   0.28.1
import numpy as np
from scipy.spatial import ConvexHull
segfaulter = np.array(
        [[ 0. ,  2.5],
         [ 0. ,  3.5],
         [ 0. ,  4.5],
         [ 0. ,  1.5],
         [ 2. ,  5.5],
         [ 2. ,  6.5],
         [ 2. ,  0.5],
         [ 2. , -0.5],
         [ 2.5,  0. ],
         [ 2.5,  6. ],
         [ 3.5,  0. ],
         [ 3.5,  6. ],
         [ 4. ,  5.5],
         [ 4. ,  6.5],
         [ 4. ,  0.5],
         [ 4. , -0.5],
         [ 4.5,  0. ],
         [ 4.5,  6. ],
         [ 5.5,  2. ],
         [ 5.5,  4. ],
         [ 6. ,  2.5],
         [ 6. ,  3.5],
         [ 6. ,  4.5],
         [ 6. ,  1.5],
         [ 6.5,  2. ],
         [ 6.5,  4. ],
         [ 0.5,  2. ],
         [ 0.5,  4. ],
         [-0.5,  2. ],
         [-0.5,  4. ],
         [ 1.5,  0. ],
         [ 1.5,  6. ]], dtype=np.float64)
ConvexHull(segfaulter)
$ python run_segfaulter.py
/Users/travis/.travis/job_stages: line 104: 81648 Segmentation fault: 11  python run_segfaulter.py
The command "python run_segfaulter.py" failed and exited with 139 during .
Your build has been stopped.
Sorry, Iām not too versed in OSX, so maybe somebody else can take it from here š
It could be related to https://github.com/scipy/scipy/issues/5450 ???
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 30 (20 by maintainers)
Commits related to this issue
- Add a test case of the segfaulter in Issue #9751 — committed to hmaarrfk/scipy by hmaarrfk 5 years ago
Just to add another confirmation of this issue. My os is a bit old:
Running the same code as the original poster, I get a Segmentation Fault with scipy==1.3.0. However, it seems the issue was somehow introduced between scipy==1.1.0 and scipy==1.2.0. The call is successful for scipy==1.1.0, but not for scipy==1.2.0 and later.
I had a similar problem when using functions from scipy.spatial and downgrading scipy fixed it for me. Now I use the following
The 1.2.0 wheels should be built with Mac OS 10.13.3, Apple LLVM 9.1.0 (clang -902.0.39.2), which appears to actually mean LLVM 5.0.2.
The problem scenario described appears to be Apple LLVM version 9.0.0 (clang-900.0.37), which seems to actually be LLVM 4.0.0.
It seems unlikely that the LLVM version discrepancy itself would be a problem with the pre-built SciPy binary pip installed, but maybe there are missing runtime dependencies like libc++ headers. See: https://github.com/youknowone/xcode-libcxx
There seems to be a complicated history of deprecating libstdc++ support and moving to libc++, and having Mac OS distributions very slowly follow suit, with Xcode sometimes missing certain headers?