title: Raspberry PI 4 - 8GM RAM - 64 bit OS aarch64 - easyocr - torch - opencv - illegal instruction
body: <p>I am trying to get easyocr running on a raspberry pi 4 and could use some suggestions or help.  I am using the 64 bit build from May 7th - 2021 (2021-05-07-raspios-buster-arm64.zip).  When I do a fresh OS install, I execute the following commands:</p>
  <pre><code>sudo vi /etc/dphys-swapfile # change swapfile to 2GB
  sudo raspi-config # expand the filesystem to use the entire SD card
  sudo apt-get update #
  sudo apt-get upgrade #
  sudo apt autoremove # The following packages will be REMOVED: python-colorzero
  sudo python -m pip install --upgrade pip # upgrade pip
  sudo pip3 install --upgrade pip # upgrade pip3
  sudo python3 -m pip install numpy --upgrade # upgrade numpy
  sudo python3 -m pip install easyocr # install easyocr
  </code></pre>
  <p>I open a python3 editor and execute the following commands:</p>
  <pre><code>import cv2
  import torch
  import easyocr
  reader = easyocr.Reader(['en'])
  results = reader.readtext('/home/pi/Downloads/Calibration.bmp')
  </code></pre>
  <p>The last command results in an Illegal instruction error.  I figured openCV was the likely culprit so I compiled it from source and tried again.  I got the same error.  I have tried going with a 32 bit build, but torch needs 64 bit to work.  I have tried the same sequence and code through Anaconda on a windows 64 bit machine and it works without issue.</p>
  <p>My next two attempts will be to build easyocr and/or torch from source , but I am grasping at straws here.  I am really not sure how to figure out what software is causing the illegal instruction so I can hone in on that package.  I would appreciate any thoughts on what I can do to get more information or thoughts on what things I can try.</p>
  <p>Thanks a bunch.</p>
  <p>[EDIT]I installed python3-dbg so I could run the application under gdb.  When I do, the error I get is</p>
  <pre><code>Thread 1 &quot;python3-dbg&quot; received signal SIGILL, Illegal instruction. 0x0000ffffe4189fc8 in exec_blas () from 
  /home/[USER]/.local/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so
  </code></pre>
  <p>[EDIT2]<a href="https://github.com/KumaTea/pytorch-aarch64" rel="nofollow noreferrer">I found a git hub repository that creates wheel files (WHL) for those having illegal instruction errors like me.</a>  So far it hasn't helped.  I have tried a few, but am going to use a more systematic approach. to see if I can find the right combination.</p>