Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal instruction error #231

Closed
nimitjainFireLab opened this issue Jan 17, 2022 · 13 comments
Closed

Illegal instruction error #231

nimitjainFireLab opened this issue Jan 17, 2022 · 13 comments

Comments

@nimitjainFireLab
Copy link

nimitjainFireLab commented Jan 17, 2022

Hello

I was following the instructions for installation from here (https://www.thedigitalpictureframe.com/how-to-add-crossfading-slide-transitions-to-your-digital-picture-frame-using-pi3d/) for Raspberry pi 2, running buster. Everything went fine till I tried to launch picframe using "picframe -i ." for initial configuration. Entering that just gives me an Illegal instruction error. Why would this be?
Thanks

Update after about 1 hour more working on this: it seems that when I import the following modules into python3, I get illegal instruction errors as well: numpy, ninepatch and pi3d. I was able to fix the numpy error by installing the Raspbian version of numpy as instructed here: https://numpy.org/devdocs/user/troubleshooting-importerror.html. Not quite sure how to fix the issue for ninepatch or pi3d. And not quite sure if just fixing these modules would resolve the overall error.

The following modules import fine: iptcinfo3, PIL, exifread, picframe, yaml, paho.

@paddywwoof
Copy link
Collaborator

What error message do you get when you try to import on command line

pip3 install pi3d --user

Say, or ninepatch?

@nimitjainFireLab
Copy link
Author

pi3d and ninepatch can be installed fine using pip3. I meant that when I open the python3 interpreter (by just typing python3 on the command line) and type in "import pi3d" or "import ninepatch," I get an illegal instruction error and the python3 interpreter quits.

@paddywwoof
Copy link
Collaborator

paddywwoof commented Jan 17, 2022

I wonder if it's related to numpy/numpy#18131 (comment)

What version of numpy do you now have installed (and what did pip3 get you)? And does the pi3d error happen now you have a different numpy?

PS does
from PIL import Image
work without error?

PPS might be worth running a one line python script rather than using the python interpreter terminal so you can see the actual error message with some line numbers and a trace

@nimitjainFireLab
Copy link
Author

nimitjainFireLab commented Jan 17, 2022

When I installed picframe initially, numpy-1.21.5 was installed as a dependency. This was giving an illegal instruction error when I tried importing numpy as a module using the python3 interpreter. I then did "pip3 uninstall numpy" followed by "sudo apt install python3-numpy." Now, when I import numpy using the python3 interpreter, it works fine. I did not test whether pi3d or ninepatch were importing fine before I changed the numpy version.

Thanks for checking about PIL further. It indeed is not working correctly:

from PIL import image
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'image' from 'PIL' (/home/pi/.local/lib/python3.7/site-packages/PIL/init.py)

@paddywwoof
Copy link
Collaborator

Hmm, that looks like just the difference between image and Image. Could you try with an upper case i? I only suggested checking that because PIL.Image is a dependency of ninepatch.

I take it from your comment

I did not test whether pi3d or ninepatch were importing fine before I changed the numpy version.

that when you try to import either of them now you get the 'illegal instruction' and interpreter crash?

@nimitjainFireLab
Copy link
Author

nimitjainFireLab commented Jan 17, 2022

Sorry about the case error! "from PIL import Image" also gives me an illegal instruction error.
And yes, when I now import either pi3d or ninepatch, I get 'illegal instruction' and interpreter crashing.

pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import pi3d
Illegal instruction
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import ninepatch
Illegal instruction
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from PIL import Image
Illegal instruction
pi@raspberrypi:~ $

Writing a one line python script (consisting of just importing the modules as above in the interpreter) also gave me "Illegal instruction." Did not produce line numbers and a trace.

How can I check that my hardware architecture is compatible with all these modules?

Thanks for all your help!

@paddywwoof
Copy link
Collaborator

It looks like it's the PIL Image import that's causing the problem as pi3d and ninepatch both use that (as does picframe in lots of places). It is possible to set up pi3d to not use PIL but that seems to being circumvented by the the fact that it produces too serious an error to catch in a try block https://github.com/tipam/pi3d/blob/1f1c822dc3ac58344ad2d5468978d62e51710df4/pi3d/constants/__init__.py#L63

What version do you get if you do

>>> import PIL
>>> PIL.__version__
'4.3.0'
>>> 

The whole thing does seem odd. You can (or used to be able. ED - just checked and it seems to be in buster https://packages.debian.org/source/buster/pillow) install a debian package for PIL

sudo apt install python3_pil

@nimitjainFireLab
Copy link
Author

I get
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import PIL
PIL.version
'9.0.0'

Should I uninstall this PIL and get the debian package instead? That's kind of what I did for numpy

@paddywwoof
Copy link
Collaborator

Well it would give a bit more info whether it works or not.

@nimitjainFireLab
Copy link
Author

Sweet! Uninstalling that pillow version and installing the debian package resolved everything. I also got the "Have a Break" photo with picframe. Thanks so much for your help and patience!

@paddywwoof
Copy link
Collaborator

Thanks for reporting the problem. It looks like there might be an issue with PIL 9.0.0 on arm 6 at least so I had better do a bit more checking on that. But the fact that you had a problem with numpy as well makes me think that both are related to something else.

@helgeerbe
Copy link
Owner

helgeerbe commented Jan 18, 2022

I'm running PIL 9.0.0 without an issue. For the next release I changed the dependency to this version because it fixes #182

I simply run pip3 install Pillow --upgrade

Do we have an issue here?

@helgeerbe helgeerbe reopened this Jan 18, 2022
@helgeerbe
Copy link
Owner

Close this, because of no feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants