coqui-ai / TTS

πŸΈπŸ’¬ - a deep learning toolkit for Text-to-Speech, battle-tested in research and production
http://coqui.ai
Mozilla Public License 2.0
35.08k stars 4.27k forks source link

[Bug] Illegal Instruction while installing to RasPi #2455

Closed makermelissa closed 1 year ago

makermelissa commented 1 year ago

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 commented 1 year ago

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

mitchind commented 1 year ago

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"

mitchind commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Ok. Will give 32 bit a try and confirm

resatkrlc commented 1 year ago

Ok. Will give 32 bit a try and confirm

Working?

mitchind commented 1 year ago

No. Same result

On Mon, Apr 10, 2023, 9:07 p.m. Resat @.***> wrote:

Ok. Will give 32 bit a try and confirm

Working?

β€” Reply to this email directly, view it on GitHub https://github.com/coqui-ai/TTS/issues/2455#issuecomment-1502658856, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2UKW5ABA2673SSR43KQA3XATKG3ANCNFSM6AAAAAAWF2JU2M . You are receiving this because you commented.Message ID: @.***>

MartinMcGrath commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

mitchind commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

mitchind commented 1 year ago

@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

  1. git clone https://github.com/coqui-ai/TTS
  2. Edit the requirements file and remove references to torch torchaudio numpy and numba
  3. pip install numba
  4. pip install -e .
  5. pip install urllib3==1.26.11 --upgrade
stale[bot] commented 1 year ago

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.