0

I was trying to install smbus2 with pip3 in raspberrypi 4(raspberry pi os 64bit). But it says "Illegal instruction". Why does it happen and How can I solve it?

pi@raspberrypi:~ $ pip3 install smbus2
Illegal instruction

2 Answers2

0

In general, which means there may be a million exceptions, illegal instruction means you're using s/w that was compiled against a different architecture. RPI0 is arm6 so if you install something compiled with arm7 for example you'll get that error.

You might find a better explanation here: https://forums.raspberrypi.com/viewtopic.php?t=293114

JustSightseeing
  • 1,460
  • 3
  • 17
  • 37
  • 1
    You can see the whole reddit thread about this here https://www.reddit.com/r/learnpython/comments/rmv1at/pip_illegal_instruction/?utm_source=share&utm_medium=android_app&utm_name=androidcss&utm_term=1&utm_content=share_button – Gaël James Dec 17 '22 at 11:54
0

I originally created the environment on my raspberry pi 4 with the defaults conda channel. In this environment pip caused this "Illegal instruction" error. Once I switched to the conda-forge channel everything worked as expected without errors.

I had the idea, because the miniforge base environment worked on a raspberry pi out of the box: https://github.com/conda-forge/miniforge

There it says: "conda-forge set as the default (and only) channel".

cs224
  • 328
  • 2
  • 12