Illegal Instruction importing tensorflow

Hello to the community, first of all.
I am trying to get through the ‘For Beginners’ example on the Tensorflow Overview page but can’t event get that to work. I am trying to run it on a Core i5 laptop, so no GPU, which has AVX but not AVX2 support. I have narrowed the issue down to the ‘Import tensorflow as tf’ instruction which causes an Illegal Instruction message to be displayed. Environment is python 3.8.10, Tensorflow 2 installed with ‘pip install tensorflow’ Zorin OS 16 which is based on Ubuntu 20.04 LTS. Can anyone suggest what I need to look for? Sorry if this is simple, I’m new to this.

@Jericho_Cross,

Welcome to the Tensorflow Forum!

CPUs with no AVX support are no longer supported by the default package. You have to compile from the source or use a cloud version of TF i.e. Google Colab.

Thank you!

@chunduriv ,

Yes, I have read that in various places but my CPU does have support for AVX. I tested it with

grep avx /proc/cpuinfo

and it is listed in the flags against all four cores.

Could you please share complete details of your machine to debug further?

Yes, of course. What information do you need? Sorry, I’m new to all this but if you can tell me what you need to know, I can get it for you.

@Jericho_Cross,

Please provide the details below

  1. OS Platform and Distribution
  2. TensorFlow version
  3. CPU Specifications
  4. Steps that you have followed to install TensorFlow

Thank you!

@chunduriv

  1. Zorin OS 16 (based on Ubuntu 20.04 LTS)
  2. Tensorflow version 2.11.0 (latest stable)
  3. From lscpu:

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 36 bits physical, 48 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 58
Model name: Intel(R) Core™ i5-3230M CPU @ 2.60GHz
Stepping: 9
CPU MHz: 1450.367
CPU max MHz: 3200.0000
CPU min MHz: 1200.0000
BogoMIPS: 5188.62
Virtualisation: VT-x
L1d cache: 64 KiB
L1i cache: 64 KiB
L2 cache: 512 KiB
L3 cache: 3 MiB
NUMA node0 CPU(s): 0-3
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Unknown: No mitigations
Vulnerability Retbleed: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Vulnerable: No microcode
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts md_clear flush_l1d

  1. I followed the install process detailed on tensorflow.org/install:

pip install --upgrade pip
pip install tensorflow

Then I added the following:

pip install --upgrade intel-extension-for-tensorflow[cpu]

Hello, have you found any solution to the problem? I got the same problem with tensorflow 2.11 version on Ubuntu 20.04, and intel xeon gold 5318Y processor which supports avx operations.