pythonaltairraspberry-pi-zero

altair python package gives "Illegal instruction" on Raspberry PI


In my RaspberryPI ZERO W I got strange error when trying to import altair module in python script.

pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import altair
Illegal instruction

pi@raspberrypi:~ $ pip3 freeze
altair==4.2.0

Does anybody have an idea if there is a version, which works on RaspberryPi? Or any other idea why it is happening?


Solution

  • Illegal Instruction means that you are importing a C extension that is compiled incorrectly for the system you are using. Altair itself doesn't have any C extensions, but it depends on a number of libraries that do include C extensions, which you can see in its requirements.txt file:

    entrypoints
    jinja2
    jsonschema>=3.0
    numpy
    pandas>=0.18
    toolz
    

    I would suggest trying to import each of these libraries to narrow-down which package is incorrectly installed, and then search for information on how to correctly install the problematic package on RaspberryPi ZERO.