0

I am experiencing weird problems with python / anaconda / sklearn. I don't know which one is the source of the problem.

The problem I'm having is that I can't execute certain sklearn code anymore. Whereas before I could execute these same code parts without any issue.

Every time it throws this error:

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

My python version is 3.8.8

A minimal reproducible example:

import numpy as np

X = np.array([1, 0, 2, 0, 3, 0, 4, 0]).reshape(-1, 1)
y = np.array([1, 2, 3, 4, 5, 6, 7, 8]).reshape(-1, 1)

from sklearn.linear_model import LinearRegression

lin_reg = LinearRegression()

lin_reg.fit(X, y) # this line fails

As you can see, even very uncomplicated code already causes problems.

What have I already done so far:

  • found the questions related to this error message on this website and read those

  • reinstalled anaconda (incl using anaconda-clean)

  • reinstalled the necessary modules

  • tried updating the modules

  • trying to find a minimal reproducible example

One of the recommendations was to look for the line of code that causes the issue. However, it seems like a more general problem: whenever I use sklearn code this happens, whereas before it just worked.

I am starting to think that some recent general Ubuntu 18.04 updates are causing the issue, however, I cannot tell.

Someone who could help me some steps in the right direction? That would be great.

Any help would be appreciated a lot!

edit:

I am getting closer to pinpointing the problem I think.

this piece of code also throws the same error message

import numpy as np
X = np.array([1, 0, 2, 0, 3, 0, 4, 0]).reshape(-1, 1)
y = np.array([1, 2, 3, 4, 5, 6, 7, 8]).reshape(-1, 1)

X = np.concatenate([np.ones(shape=[8, 1]), X], axis=1) 
betas = np.invert(np.transpose(X).dot(X)).dot(np.transpose(X)).dot(y) # this line fails

indicating the problem is located within my numpy ?

  • The problem is that one of the libraries is causing segmentation faults (probably incompatibilities between numpy and python versions). Are you trying to install specific versions of libraries ? – qmeeus May 12 '21 at 10:23
  • Not in particular or at least not on purpose. With libraries, do you mean python libraries or other libraries (c or c++?)? – cliffhanger-be May 12 '21 at 11:28
  • I mean python libraries that use C/C++ in the background, but my bets are on numpy or scipy. When you reinstalled anaconda, it was working before you started installing libraries? (normally, numpy and scikit-learn come preinstalled in the base environment) – qmeeus May 12 '21 at 11:38
  • I verified, doesn't work. Thanks for the suggestion though. – cliffhanger-be May 12 '21 at 12:22
  • Does it still crash if you try the same in a new simple conda env? Can you do you something like `conda create -n testenv python numpy scipy scikit-learn` and try there to check? I've found that updating an existing env sometimes causes trouble with binaries, especially if I have mixed channels in conda! – Tim Jim May 12 '21 at 14:32
  • Thanks Tim Jim, unfortunately it does – cliffhanger-be May 12 '21 at 14:49
  • You can check answers on the same problem here: [Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)](https://stackoverflow.com/questions/49414841/process-finished-with-exit-code-139-interrupted-by-signal-11-sigsegv) – Eddy Piedad May 12 '21 at 15:04
  • This issue is often caused by incompatible libraries in your environment. – Dimitris Paraschakis Apr 13 '22 at 11:07

0 Answers0