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

[Bug] Illegal Instruction while installing to RasPi #2455

Closed
makermelissa opened this issue Mar 23, 2023 · 18 comments
Closed

[Bug] Illegal Instruction while installing to RasPi #2455

makermelissa opened this issue Mar 23, 2023 · 18 comments
Labels
bug Something isn't working wontfix This will not be worked on but feel free to help.

Comments

@makermelissa
Copy link

Describe the bug

After installation via PyPI according to the instructions, when trying to run tts from the command line or importing into python, it results in "Illegal instruction". This is installed on a Raspberry Pi running the latest 64-bit Bullseye Lite. I'm wondering if it won't run on 64-bit or something.

To Reproduce

Install in on a Raspberry Pi running the latest 64-bit Bullseye Lite via PyPI according to the instructions and then try to do anything with it.

Expected behavior

It should work

Logs

No response

Environment

Illegal instruction

Additional context

No response

@makermelissa makermelissa added the bug Something isn't working label Mar 23, 2023
@makermelissa
Copy link
Author

I tried installing from source and ran into the same issue.

@mitchind
Copy link

Same result on using "pip install tts" on Raspberry Pi 4B and latest 64 bit Bullseye Desktop from Feb 21, 2023.
No issues or errors with installing from pip.
Typing tts with anything or by itself comes back with "illegal instruction"

@erogol erogol changed the title [Bug] Illegal Instruction [Bug] Illegal Instruction while installing to RasPi Mar 27, 2023
@mitchind
Copy link

Just to clarify when looking at your title change - There is no bug or error report when installing.
It is only when you type in "tts" after the successful install
Same issue with latest Ubuntu for Raspberry Pi 64 bit.
It adds a couple words afterwards "Illegal instruction (core dump)"

@makermelissa
Copy link
Author

Correct. I didn't test it, but my guess would be it may only work correctly on 32-bit. Unfortunately, I have other required packages that only work on 64-bit.

@mitchind
Copy link

Ok. Will give 32 bit a try and confirm

@resatkrlc
Copy link

Ok. Will give 32 bit a try and confirm

Working?

@mitchind
Copy link

mitchind commented Apr 11, 2023 via email

@MartinMcGrath
Copy link

Arrived here via Phoenix10.1. Some basic debugging shows a problem with pytorch:

marto@shemp:~/TTS $ gdb --args python /home/marto/.local/bin/tts
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...
(No debugging symbols found in python)
(gdb) r
Starting program: /usr/bin/python /home/marto/.local/bin/tts
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ff55a91c0 (LWP 1386)]
[New Thread 0x7ff4da81c0 (LWP 1387)]
[New Thread 0x7ff05a71c0 (LWP 1388)]
[New Thread 0x7feb43a1c0 (LWP 1389)]
[New Thread 0x7fe8c391c0 (LWP 1390)]
[New Thread 0x7fe64381c0 (LWP 1391)]
[Thread 0x7fe64381c0 (LWP 1391) exited]
[Thread 0x7fe8c391c0 (LWP 1390) exited]
[Thread 0x7feb43a1c0 (LWP 1389) exited]
[Thread 0x7ff05a71c0 (LWP 1388) exited]
[Thread 0x7ff4da81c0 (LWP 1387) exited]
[Thread 0x7ff55a91c0 (LWP 1386) exited]
[Detaching after fork from child process 1393]

Thread 1 "python" received signal SIGILL, Illegal instruction.
0x0000007fd71243ac in std::string::_Rep::_M_dispose(std::allocator<char> const&) [clone .part.0] ()
   from /home/marto/.local/lib/python3.9/site-packages/torch/lib/../../torch.libs/libarm_compute-5d3d2ba2.so
(gdb) disassemble
Dump of assembler code for function _ZNSs4_Rep10_M_disposeERKSaIcE.part.0:
   0x0000007fd7124380 <+0>:	adrp	x2, 0x7fd757e000
   0x0000007fd7124384 <+4>:	ldr	x2, [x2, #1384]
   0x0000007fd7124388 <+8>:	cbnz	x2, 0x7fd71243a4 <_ZNSs4_Rep10_M_disposeERKSaIcE.part.0+36>
   0x0000007fd712438c <+12>:	ldr	w2, [x0, #16]
   0x0000007fd7124390 <+16>:	sub	w3, w2, #0x1
   0x0000007fd7124394 <+20>:	str	w3, [x0, #16]
   0x0000007fd7124398 <+24>:	cmp	w2, #0x0
   0x0000007fd712439c <+28>:	b.le	0x7fd71243b4 <_ZNSs4_Rep10_M_disposeERKSaIcE.part.0+52>
   0x0000007fd71243a0 <+32>:	ret
   0x0000007fd71243a4 <+36>:	add	x3, x0, #0x10
   0x0000007fd71243a8 <+40>:	mov	w2, #0xffffffff            	// #-1
=> 0x0000007fd71243ac <+44>:	ldaddal	w2, w2, [x3]
   0x0000007fd71243b0 <+48>:	b	0x7fd7124398 <_ZNSs4_Rep10_M_disposeERKSaIcE.part.0+24>
   0x0000007fd71243b4 <+52>:	b	0x7fd6e60000 <_ZNSs4_Rep10_M_destroyERKSaIcE@plt>
End of assembler dump.
(gdb) 

python -c "import torch;print(torch.__version__)" throws the error. This issue has been patched. If I can get it to build from source on the pi I'll report back.

@mitchind
Copy link

mitchind commented May 2, 2023

Nice sleuthing.
I know Q-Engineering has instructions for building Pytorch on 64 bit bullesye on Pi4
but I thought a prebuilt wheel would suffice

I'll follow this thread and see where it goes.

@MartinMcGrath
Copy link

Nice sleuthing. I know Q-Engineering has instructions for building Pytorch on 64 bit bullesye on Pi4 but I thought a prebuilt wheel would suffice

I'll follow this thread and see where it goes.

I'm not a python guy, if there's some pre-compiled version of bleed pytorch I'm happy to install and try. It's building now, but it's a slow process, I'll leave it running, hopefully it doesn't die. I won't have sufficient spare time to setup a cross compiling environment for a while.

@mitchind
Copy link

mitchind commented May 2, 2023

Their github page has a wheel for PyTorch 1.13 (64 bit Bullseye - and Python 3.9) on Google Drive

If yours craps out I'll give it a shot

From their web page

Instructions

$ sudo apt-get update
$ sudo apt-get upgrade

install the dependencies (if not already onboard)

$ sudo apt-get install python3-pip libjpeg-dev libopenblas-dev libopenmpi-dev libomp-dev

above 58.3.0 you get version issues

$ sudo -H pip3 install setuptools==58.3.0
$ sudo -H pip3 install Cython

install gdown to download from Google drive

$ sudo -H pip3 install gdown

Bullseye OS

download the wheel

$ gdown https://drive.google.com/uc?id=1uLkZzUdx3LiJC-Sy_ofTACfHgFprumSg

install PyTorch 1.13.0

$ sudo -H pip3 install torch-1.13.0a0+git7c98e70-cp39-cp39-linux_aarch64.whl

clean up

$ rm torch-1.13.0a0+git7c98e70-cp39-cp39-linux_aarch64.whl

@MartinMcGrath
Copy link

@mitchind that doesn't look like it has been updated since December, so this won't have been backported.

@mitchind
Copy link

mitchind commented May 2, 2023

Ahh okay @MartinMcGrath - I admit I'm out of my element here
Are you saying we need an older version of pytorch?
Or all the dependencies have to be recompiled to match this version?

@MartinMcGrath
Copy link

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu gets around the pytorch 'illegal instruction' problem, cloning TTS and installing from source threw some errors about dependency versions. You may need to upgrade numpy and numba packages, the TTS builds fine and a command line test produces the expected output.

diff requirements.txt requirements.orig 
2c2
< numpy==1.24.3;python_version<"3.10"
---
> numpy==1.21.6;python_version<"3.10"
47a48
> 

@mitchind
Copy link

Thanks @MartinMcGrath - when you say "the TTS builds fine", you were able to use pip install tts aftewards?
Or you did the git clone and build from there after torch installs?

@MartinMcGrath
Copy link

@mitchind as above clone the repo, edited requirements, potential numpy and numba version issues, and TTS built fine without issue.

@mitchind
Copy link

mitchind commented May 28, 2023

@MartinMcGrath - thanks - I'm did give this a shot
Just confirmed it will work as you described - steps I took below

_1. pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
2. git clone https://github.com/coqui-ai/TTS
3. Edit the requirements file and remove references to torch torchaudio numpy and numba
4. pip install numba
5. pip install -e .
6. pip install urllib3==1.26.11 --upgrade

@stale
Copy link

stale bot commented Jun 30, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You might also look our discussion channels.

@stale stale bot added the wontfix This will not be worked on but feel free to help. label Jun 30, 2023
@stale stale bot closed this as completed Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on but feel free to help.
Projects
None yet
Development

No branches or pull requests

4 participants