Calling Python through ssh in Python script causes "Illegal instruction (core dumped)"

Viewed 1884

I have a Python script call.py to log in to another machine through ssh and execute another Python script saved on this machine, something like this

# call.py
import os

# log into user@host machine and execute python script
os.system("sshpass -p password ssh user@host '( python3 my_script.py )'")

but when I try to run it I get this error

Illegal instruction     (core dumped)  ( python3 my_script.py )

I tried a few things:

  • If I log into ssh and launch python3 my_script.py through the terminal it works
  • I also tried running the same call.py script without the ssh part, so trying to launch my_script.py on the same machine and it works

It seems that only the combination of ssh + python inside python that gives me this error. Any pointers on what could cause the error will be very much appreciated.

Edit: I didn't realize it would play a role, but I'm adding now the important detail that the target machine is an Nvidia Jetson board.

1 Answers

I found the solution for my case, in case it can help someone else. As pointed out by Thomas, the problem was that I was working with different systems, in the specific my target machine was a Jetson while I was running ssh from my laptop.

On my Jetson board I had seen the Illegal instruction (core dumped) when trying to import OpenCV, to which the solution was to export OPENBLAS_CORETYPE=ARMV8 to the ~/.bashrc.

In order to make this work through ssh, I had to modify my command to call python this way:

OPENBLAS_CORETYPE=ARMV8 python3

and now it works!

Related