Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

illegal hardware instruction python #29

Open
kufton opened this issue Apr 5, 2023 · 22 comments
Open

illegal hardware instruction python #29

kufton opened this issue Apr 5, 2023 · 22 comments

Comments

@kufton
Copy link

kufton commented Apr 5, 2023

This may well be a user error, however I've used pip and the local source build on m1 and get the same issue:

(ven) (base) me@MacBook-Air chat % python
Python 3.9.13 (main, Aug 25 2022, 18:29:29)
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyllamacpp.model import Model
zsh: illegal hardware instruction python

I've used virtual env and can run the llama model via its ./ script just fine, I'm just trying to get the python bindings working

@abdeladim-s
Copy link
Collaborator

@kufton, I don't think this is related to the bindings,
rather related to your python installation.

I will leave it open, in case someone using Mac wanted help you

@kufton
Copy link
Author

kufton commented Apr 5, 2023

Ok I'll dig into that thanks

@gmankab
Copy link

gmankab commented Apr 6, 2023

same error

Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyllamacpp.model import Model
[1]    12305 illegal hardware instruction (core dumped)  python

i tried to install it via pip install pyllamacpp

and i tried to compile it via

pip uninstall pyllamacpp
git clone --recursive https://github.com/nomic-ai/pyllamacpp && cd pyllamacpp
pip install .
neofetch

image

@mhlinder
Copy link

mhlinder commented Apr 7, 2023

Also seeing this, on an M1 Mac:

In [1]: import pyllamacpp.model

Process Python illegal instruction: 4

I get this error from a different angle:

$ python -c "import pyllamacpp.model"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/henry/build/pyllamacpp/pyllamacpp/model.py", line 21, in <module>
    import _pyllamacpp as pp
ImportError: dlopen(/Users/henry/.pyenv/versions/science-3.9.10/lib/python3.9/site-packages/_pyllamacpp.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (_cblas_sgemm)

@abdeladim-s
Copy link
Collaborator

I think it is the same as #36.
Could you please try the latest commits guys ?

@kufton
Copy link
Author

kufton commented Apr 8, 2023

I get the same hardware error.
I know I'm having issues with virtual env so it could still be a me thing, though I appreciate others contributing

@abdeladim-s
Copy link
Collaborator

@kufton, are using a conda env ?
Have you tried to used a regular venv ?

@kufton
Copy link
Author

kufton commented Apr 9, 2023 via email

@abdeladim-s
Copy link
Collaborator

I was using venv through terminal but I’ve created a new one in anaconda to try in there and I’ll do the same in pycharm. More than happy for it to be a me problem. I’ve just never got such an unhelpful error from Python before lol!
On Sun, 9 Apr 2023 at 09:03, Abdeladim Sadiki @.> wrote: @kufton https://github.com/kufton, are using a conda env ? Have you tried to used a regular venv ? — Reply to this email directly, view it on GitHub <#29 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AART3FEN4T5XKV7CSA6BF2LXAHVD3ANCNFSM6AAAAAAWTR3EKE . You are receiving this because you were mentioned.Message ID: @.>
-- Kaleb Ufton

Yeah it happens sometimes 🙂
Please let us know if you find any solution.

@georgebdavis
Copy link

georgebdavis commented Apr 10, 2023

FYI: seeing same issue on M1 mac w/ a12f4cd , which I think includes fixes for #36 ? I tried with a vanilla venv and also with no venv. Let me know any suggestions you'd like me to try!

@mhlinder
Copy link

mhlinder commented Apr 11, 2023

Confirmed that #36 seems to be the same, but that solution did not work for me

@abdeladim-s
Copy link
Collaborator

FYI: seeing same issue on M1 mac w/ a12f4cd , which I think includes fixes for #36 ? I tried with a vanilla venv and also with no venv. Let me know any suggestions you'd like me to try!

Hi @georgebdavis, thanks for reporting this.
Could you please let me know what version of Python are you using ?
Have you tried to build it from source ?

@andzejsp
Copy link

Hi, im using the gpt4all-ui, trying to run it on ubuntu/debian VM and having illegal instructions too. ParisNeo/lollms-webui#55 (comment) Maybe there is something i could help to debug here? Im not very smart but i can open terminal and enter commands :).

Looking for solution, thank you

@georgebdavis
Copy link

@abdeladim-s sorry for slow reply here! I did indeed compile from source, and I'm using python 3.10.5. lmk if I can offer other environment details or attempt to capture stack etc., and thanks for all the hard work.

@abdeladim-s
Copy link
Collaborator

Hi, im using the gpt4all-ui, trying to run it on ubuntu/debian VM and having illegal instructions too. nomic-ai/gpt4all-ui#55 (comment) Maybe there is something i could help to debug here? Im not very smart but i can open terminal and enter commands :).

Looking for solution, thank you

Hi @andzejsp,

it should be working on Ubuntu normally, People are having issues with Mac
Could you please try the installation and the usage sections from the readme ?
Thank you!

@abdeladim-s
Copy link
Collaborator

@abdeladim-s sorry for slow reply here! I did indeed compile from source, and I'm using python 3.10.5. lmk if I can offer other environment details or attempt to capture stack etc., and thanks for all the hard work.

Thanks @georgebdavis very much for your time.

so it didn't work even after compiling from source ? Does the llama.cpp work without issues ?
Have you tried with Python 3.9 ?
Any stack trace or insights will be helpful!

@Subcode
Copy link

Subcode commented Apr 15, 2023

Hi, im using the gpt4all-ui, trying to run it on ubuntu/debian VM and having illegal instructions too. nomic-ai/gpt4all-ui#55 (comment) Maybe there is something i could help to debug here? Im not very smart but i can open terminal and enter commands :).
Looking for solution, thank you

Hi @andzejsp,

it should be working on Ubuntu normally, People are having issues with Mac Could you please try the installation and the usage sections from the readme ? Thank you!

Doesnt work for me either in Ubuntu 20,04. Same Illegal instruction (core dumped) both from pip and compiled from source.
Python 3.10.6

@andzejsp
Copy link

andzejsp commented Apr 16, 2023

Check your CPU instructions set extension. You gotta have a X2, if you don't have then you need to compile pyllamacpp from source

ParisNeo/lollms-webui#74 (comment)

@Subcode
Copy link

Subcode commented Apr 16, 2023

I compiled from source already.

@mikeliao97
Copy link

running into same issue, any luck?

@georgebdavis
Copy link

I got lucky and spotted this comment in a related thread. I dug in and realized that I was running an x86_64 install of python due to a hangover from migrating off a pre-M1 laptop.

After a clean homebrew install, pip install pygpt4all + sample code for ggml-gpt4all-j-v1.3-groovy.bin worked out of the box -- no build from source required.

Homebrew, conda and pyenv can all make it hard to keep track of exactly which arch you're running, and I suspect this is the same issue for many folks complaining about illegal instructions @abdeladim-s !

@abdeladim-s
Copy link
Collaborator

Yes I agree @georgebdavis, especially the folks with M1-chip.
I hope future users won't get tricked into this.

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

No branches or pull requests

8 participants