pythonoperating-systemcpusystem-requirements

lapjv - Illegal instruction (core dumped)


I've read that Illegal instruction (core dumped) error may be because of some machine issues or version issues.

However, my case is weird because I have two scripts - one dummy script to test the function and another one is my actual script. The weird thing is, it works for my dummy script (minimum cost and everything calculated correctly, the script executed with no errors, etc). But when I tried to execute the function in my actual script it throws a Illegal instruction (core dumped) error.

I've checked that in both cases I fed in a square matrix of class 'numpy.ndarray' and the elements are of class 'numpy.float64' for both. The only difference is that the dummy matrix is a 4x4 square matrix while the actual square matrix is of size 200 by 200. I tried reducing the size to roughly 50 by 50 just to test and see if thats the issue but it still throws the same error.

Any suggestions would be really appreciated, thanks!

import numpy as np
from lapjv import lapjv

a=np.array([[5.34,3.04,2.04,8.02],
    [7.0,9.34,2.5,6.43],
    [6.,4.43,5.2,7.45],
    [5.34,7.42,7.43,8.44]])

print(type(a))
print(type(a[0]))
print(type(a[0][0]))


row_ind, col_ind, _ =lapjv(a)
print(row_ind)
print(col_ind)

This returns:

class 'numpy.ndarray'  
class 'numpy.ndarray'  
class 'numpy.float64'  
[2 3 1 0]  
[3 2 0 1]

on the command line. (everything works fine here).

But for my actual code:

from lapjv import lapjv
import numpy as np

<some code here>
if(len(qDes)<len(dbDes)):
    #pad rows
    padRows=np.zeros((diff,len(dbDes)),np.int64)
    print(len(padRows))
    print(len(padRows[0]))
    newCostMat=np.r_[costMatNP,padRows]

elif(len(qDes)>len(dbDes)):
    #padCols
    padCols=np.zeros((len(qDes),diff),np.int64)
    newCostMat=np.c_[costMatNP,padCols]

else:
    #no padding
    newCostMat=costMatNP

print(len(newCostMat[0]))
print(len(newCostMat))

print(type(newCostMat))
print(type(newCostMat[0]))
print(type(newCostMat[0][0]))

#jonker-volgenant algorithm
row_ind,col_ind, _=lapjv(newCostMat)

returns:

3  
201  
201  
201  
class 'numpy.ndarray'  
class 'numpy.ndarray'  
class 'numpy.float64'  
Illegal instruction (core dumped)  

Solution

  • I fixed it by reinstalling a new environment. Now I'm using Anaconda instead with Python 3.6.3