question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG fresh install on OSX conda env with pip gives a segfault

See original GitHub issue

We are using scikit-learn our benchopt package and we came across a weird behavior when installing the 1.0 release on OSX with pip in a conda env in the CI, where the import of scikit-learn causes a segfault.

After a bit of debugging, we were able to pinpoint that it comes from an interation with installing numba in the conda env beforehand. Here are the PR where we investigated this https://github.com/benchopt/benchOpt/pull/211 and the error log with a minimal reproduction: https://github.com/benchopt/benchOpt/runs/3733088581?check_suite_focus=true

Step to reproduce:

conda create -n test_env -c conda-forge python=3.8 numpy scipy numba
conda activate test_env
pip install scikit-learn
python -c 'from sklearn.linear_model import Lasso'

This results in:

line 4: 2841 Segmentation fault: 11  python -c 'from sklearn.linear_model import Lasso'

We fixed our issue by switching to conda install which is probably safer.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
thomasjpfancommented, Oct 2, 2021

I can reproduce on OSX intel, using this test file:

from sklearn.linear_model import Lasso

with lldb python test.py and running

Process 6123 stopped
* thread #2, stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
    frame #0: 0x000000010179b189 libomp.dylib`void __kmp_suspend_64<false, true>(int, kmp_flag_64<false, true>*) + 36
libomp.dylib`__kmp_suspend_64<false, true>:
->  0x10179b189 <+36>: movq   (%rax,%rcx,8), %r13
    0x10179b18d <+40>: movq   %r13, %rdi
    0x10179b190 <+43>: callq  0x10179a9da               ; __kmp_suspend_initialize_thread
    0x10179b195 <+48>: movq   %r13, %rdi

Looking into a fix.

0reactions
thomasjpfancommented, Oct 9, 2021

Since the nightly wheels are built openmp 11 on osx now, one can check to see if the import works with the nightly build:

pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn

The main branch and 1.0.X has not diverged too much given 1.0 was release not too long ago.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Segmentation fault 11 and other errors when trying to use JAX ...
Trying to install JAX with conda using conda install jax -c conda-forge does not work so well. It fails to solve the environment...
Read more >
Segfault when running mini_test on new install - Google Groups
The pip install works fine, but running the mini_test gives a segfault error when initializing the database. Any ideas? #.
Read more >
Getting “Segmentation fault: 11” with Shapely in Python on ...
I am fairly new to Python package management. I started with pip and then ran into a few posts of people advocating conda,...
Read more >
Installation — detectron2 0.6 documentation
PyTorch ≥ 1.8 and torchvision that matches the PyTorch installation. ... python -m pip install -e detectron2 # On macOS, you may need...
Read more >
Segmentation fault after install - build - Psi4
So I recently installed Psi4 1.3.2 for macOS with Python 3.7 from the ... current miniconda installation and just make a new environment...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found