Illegal instruction (core dumped)

I already install tensorflow by using pyhton3 ,
pip show tensorflow
Name: tensorflow
Version: 2.13.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/basma/.local/lib/python3.8/site-packages
Requires: absl-py, astunparse, flatbuffers, gast, google-pasta, grpcio, h5py, keras, libclang, numpy, opt-einsum, packaging, protobuf, setuptools, six, tensorboard, tensorflow-estimator, tensorflow-io-gcs-filesystem, termcolor, typing-extensions, wrapt
Required-by:
but when use it as:
import tensorflow as tf
the error is :Illegal instruction (core dumped)
could anyone help me please?

Hi @basma.a.jalil, Could you please confirm if your CPU supports AVX instructions? If not the Illegal instruction (core dumped)error occurs due to an incompatible CPU architecture. TensorFlow supports AVX instructions.

Another case for causing this error is Incorrect TensorFlow installation. In this case please try to uninstall and install tensorflow again. Thank You.

Thank you for your response
I checked my ubuntu not supported avx so enable it. Then reinstall tensorflow but when I import it as tf some notes has been occurred as below:

import tensorflow as tf
2023-09-29 13:25:03.310836: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-09-29 13:25:03.425198: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-09-29 13:25:03.425775: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-09-29 13:25:05.454187: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
File “”, line 1, in
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/init.py”, line 38, in
from tensorflow.python.tools import module_util as _module_util
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/init.py”, line 45, in
from tensorflow.python.feature_column import feature_column_lib as feature_column
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/feature_column/feature_column_lib.py”, line 18, in
from tensorflow.python.feature_column.feature_column import *
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/feature_column/feature_column.py”, line 143, in
from tensorflow.python.layers import base
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/layers/base.py”, line 16, in
from tensorflow.python.keras.legacy_tf_layers import base
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/keras/init.py”, line 25, in
from tensorflow.python.keras import models
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/keras/models.py”, line 22, in
from tensorflow.python.keras.engine import functional
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/keras/engine/functional.py”, line 32, in
from tensorflow.python.keras.engine import training as training_lib
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py”, line 53, in
from tensorflow.python.keras.saving import hdf5_format
File “/home/basma/.local/lib/python3.8/site-packages/tensorflow/python/keras/saving/hdf5_format.py”, line 37, in
import h5py
File “/home/basma/.local/lib/python3.8/site-packages/h5py/init.py”, line 46, in
from ._conv import register_converters as _register_converters
File “h5py/h5t.pxd”, line 14, in init h5py._conv
File “h5py/h5t.pyx”, line 293, in init h5py.h5t
File “/home/basma/.local/lib/python3.8/site-packages/numpy/init.py”, line 320, in getattr
raise AttributeError("module {!r} has no attribute "
AttributeError: module ‘numpy’ has no attribute ‘typeDict’

Could you please tell me why?

Hi @basma.a.jalil, Could you please try by installing the numpy version =1.21 by using !pip install numpy==1.21. Thank You.