Why is this "illegal instruction (core dumped)" message showing up?

Why is this Illegal instruction (core dumped) message showing up?

# File: tensorflow_installation_test.py

try:
    import tensorflow as tf
    import autokeras as ak
    from sklearn.datasets import load_digits

    print(f'TensorFlow version: {tf.__version__}')
    print(f'AutoKeras version: {ak.__version__}')

    # Create a simple TensorFlow computation
    a = tf.constant([1.0, 2.0, 3.0, 4.0])
    b = tf.constant([1.0, 2.0, 2.0, 2.0])
    result = tf.multiply(a, b)

    print(f'TensorFlow computation result: {result.numpy()}')

    # Load a small subset of the MNIST digits dataset
    digits = load_digits(n_class=2)
    x = digits.data
    y = digits.target

    # Initialize the image classifier.
    clf = ak.ImageClassifier(overwrite=True, max_trials=1)

    # Feed the image classifier with training data.
    clf.fit(x, y, epochs=1)

    print('TensorFlow and AutoKeras are properly installed and working.')

except ImportError as e:
    print(f'ImportError: {e}')
    print('Please make sure TensorFlow and AutoKeras are installed.')

except Exception as e:
    print(f'Unexpected error: {e}')
    print('There might be a problem with your TensorFlow or AutoKeras installation.')
my_user_name@192:~/my_project_name$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_Oct_11_21:27:02_PDT_2021
Cuda compilation tools, release 11.4, V11.4.152
Build cuda_11.4.r11.4/compiler.30521435_0
my_user_name@192:~/my_project_name$ nvidia-smi
Sat Dec  2 01:26:51 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.223.02   Driver Version: 470.223.02   CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:03:00.0 N/A |                  N/A |
| 33%   28C    P8    N/A /  N/A |     14MiB /  3020MiB |     N/A      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  NVIDIA GeForce ...  Off  | 00000000:84:00.0 N/A |                  N/A |
| 33%   29C    P8    N/A /  N/A |      6MiB /  3022MiB |     N/A      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
my_user_name@192:~/my_project_name$ python3 tensorflow_installation_test.py
Illegal instruction (core dumped)
my_user_name@192:~/my_project_name$ python3 -m pip show tensorflow
Name: tensorflow
Version: 2.4.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /home/my_user_name/.local/lib/python3.8/site-packages
Requires: absl-py, astunparse, flatbuffers, gast, google-pasta, grpcio, h5py, keras-preprocessing, numpy, opt-einsum, protobuf, six, tensorboard, tensorflow-estimator, termcolor, typing-extensions, wheel, wrapt
Required-by: autokeras, tensorflow-text
my_user_name@192:~/my_project_name$ python3 -m pip show autokeras
Name: autokeras
Version: 1.0.13
Summary: AutoML for deep learning
Home-page: http://autokeras.com
Author: Data Analytics at Texas A&M (DATA) Lab, Keras Team
Author-email: jhfjhfj1@gmail.com
License: MIT
Location: /home/my_user_name/.local/lib/python3.8/site-packages
Requires: keras-tuner, packaging, pandas, scikit-learn, tensorflow
Required-by:
my_user_name@192:~/my_project_name$ python3 tensorflow_installation_test.py
Illegal instruction (core dumped)
my_user_name@192:~/my_project_name$

This occurs when Tensorflow is being used on an older CPU architecture it was not compiled for. Does your CPU not have AVX instructions? You can either downgrade to an older version of Tensorflow that was compiled for your instruction set or build it from source (a fairly time-consuming process) or obtain a download from a third party (e.g. suitable whl file on github). Official Tensorflow after 1.6 requires AVX. Of course you’ll have to check it doesn’t break current pip dependencies and may have to downgrade packages.