markqvist / Sideband

LXMF client for Android, Linux and macOS allowing you to communicate with people or LXMF-compatible systems over Reticulum networks using LoRa, Packet Radio, WiFi, I2P, or anything else Reticulum supports.
Other
367 stars 27 forks source link

Sideband 0.9.0 upgrade and install error on Debian 12 #50

Closed r8io closed 4 months ago

r8io commented 4 months ago

Hi Marc, Sideband 0.9.0 is giving me an error when trying to upgrade from version 0.8.5 on Debian 12. Uninstall/install doesn't help either. On Android everything appears to be working and I am able to record audio messages.

System information

System: Linux xx 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux
Python: Python 3.11

Upgrade from Sideband 0.8.5

r8io@xx:~$ pipx upgrade sbapp
  error: subprocess-exited-with-error

  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/pyaudio
      copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-311/pyaudio
      running build_ext
      building 'pyaudio._portaudio' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/src
      creating build/temp.linux-x86_64-cpython-311/src/pyaudio
      x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/local/include -I/usr/include -I/home/r8io/.local/pipx/venvs/sbapp/include -I/usr/include/python3.11 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-311/src/pyaudio/device_api.o
      src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
          9 | #include "portaudio.h"
            |          ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
'/home/r8io/.local/pipx/venvs/sbapp/bin/python -m pip install --upgrade sbapp -q' failed

Install

r8io@xx:~$ pipx uninstall sbapp
uninstalled sbapp! ✨ 🌟 ✨

r8io@xx:~$ pipx install sbapp
Fatal error from pip prevented installation. Full pip output in file:
    /home/r8io/.local/pipx/logs/cmd_2024-06-07_10.39.36_pip_errors.log

pip failed to build package:
    pyaudio

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
    error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

Error installing sbapp.

Log file

r8io@xx:~$ cat /home/r8io/.local/pipx/logs/cmd_2024-06-07_10.39.36_pip_errors.log
PIP STDOUT
----------
Collecting sbapp
  Using cached sbapp-0.9.0-2-py3-none-any.whl.metadata (12 kB)
Collecting rns>=0.7.5 (from sbapp)
  Using cached rns-0.7.5-py3-none-any.whl.metadata (19 kB)
Collecting lxmf>=0.4.4 (from sbapp)
  Using cached lxmf-0.4.4-py3-none-any.whl.metadata (10 kB)
Collecting kivy>=2.3.0 (from sbapp)
  Using cached Kivy-2.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (15 kB)
Collecting pillow>=10.2.0 (from sbapp)
  Using cached pillow-10.3.0-cp311-cp311-manylinux_2_28_x86_64.whl.metadata (9.2 kB)
Collecting qrcode (from sbapp)
  Using cached qrcode-7.4.2-py3-none-any.whl.metadata (17 kB)
Collecting materialyoucolor>=2.0.7 (from sbapp)
  Using cached materialyoucolor-2.0.9-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (5.5 kB)
Collecting ffpyplayer (from sbapp)
  Using cached ffpyplayer-4.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.1 kB)
Collecting sh (from sbapp)
  Using cached sh-2.0.7-py3-none-any.whl.metadata (3.4 kB)
Collecting pycodec2 (from sbapp)
  Using cached pycodec2-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.0 kB)
Collecting pyaudio (from sbapp)
  Using cached PyAudio-0.2.14.tar.gz (47 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting Kivy-Garden>=0.1.4 (from kivy>=2.3.0->sbapp)
  Using cached Kivy_Garden-0.1.5-py3-none-any.whl.metadata (159 bytes)
Collecting docutils (from kivy>=2.3.0->sbapp)
  Using cached docutils-0.21.2-py3-none-any.whl.metadata (2.8 kB)
Collecting pygments (from kivy>=2.3.0->sbapp)
  Using cached pygments-2.18.0-py3-none-any.whl.metadata (2.5 kB)
Collecting cryptography>=3.4.7 (from rns>=0.7.5->sbapp)
  Downloading cryptography-42.0.8-cp39-abi3-manylinux_2_28_x86_64.whl.metadata (5.3 kB)
Collecting pyserial>=3.5 (from rns>=0.7.5->sbapp)
  Using cached pyserial-3.5-py2.py3-none-any.whl.metadata (1.6 kB)
Collecting numpy>=1.22 (from pycodec2->sbapp)
  Using cached numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
Collecting typing-extensions (from qrcode->sbapp)
  Downloading typing_extensions-4.12.1-py3-none-any.whl.metadata (3.0 kB)
Collecting pypng (from qrcode->sbapp)
  Using cached pypng-0.20220715.0-py3-none-any.whl.metadata (13 kB)
Collecting cffi>=1.12 (from cryptography>=3.4.7->rns>=0.7.5->sbapp)
  Using cached cffi-1.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB)
Collecting requests (from Kivy-Garden>=0.1.4->kivy>=2.3.0->sbapp)
  Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting pycparser (from cffi>=1.12->cryptography>=3.4.7->rns>=0.7.5->sbapp)
  Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Collecting charset-normalizer<4,>=2 (from requests->Kivy-Garden>=0.1.4->kivy>=2.3.0->sbapp)
  Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (33 kB)
Collecting idna<4,>=2.5 (from requests->Kivy-Garden>=0.1.4->kivy>=2.3.0->sbapp)
  Using cached idna-3.7-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests->Kivy-Garden>=0.1.4->kivy>=2.3.0->sbapp)
  Using cached urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests->Kivy-Garden>=0.1.4->kivy>=2.3.0->sbapp)
  Downloading certifi-2024.6.2-py3-none-any.whl.metadata (2.2 kB)
Using cached sbapp-0.9.0-2-py3-none-any.whl (43.0 MB)
Using cached Kivy-2.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.9 MB)
Using cached lxmf-0.4.4-py3-none-any.whl (34 kB)
Using cached materialyoucolor-2.0.9-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (205 kB)
Using cached pillow-10.3.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.5 MB)
Using cached rns-0.7.5-py3-none-any.whl (359 kB)
Using cached ffpyplayer-4.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.9 MB)
Using cached pycodec2-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB)
Using cached qrcode-7.4.2-py3-none-any.whl (46 kB)
Using cached sh-2.0.7-py3-none-any.whl (38 kB)
Downloading cryptography-42.0.8-cp39-abi3-manylinux_2_28_x86_64.whl (3.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.9/3.9 MB 6.6 MB/s eta 0:00:00
Using cached Kivy_Garden-0.1.5-py3-none-any.whl (4.6 kB)
Using cached numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
Using cached pyserial-3.5-py2.py3-none-any.whl (90 kB)
Using cached docutils-0.21.2-py3-none-any.whl (587 kB)
Using cached pygments-2.18.0-py3-none-any.whl (1.2 MB)
Using cached pypng-0.20220715.0-py3-none-any.whl (58 kB)
Downloading typing_extensions-4.12.1-py3-none-any.whl (37 kB)
Using cached cffi-1.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (464 kB)
Downloading requests-2.32.3-py3-none-any.whl (64 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.9/64.9 kB 3.9 MB/s eta 0:00:00
Downloading certifi-2024.6.2-py3-none-any.whl (164 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 164.4/164.4 kB 4.9 MB/s eta 0:00:00
Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
Using cached idna-3.7-py3-none-any.whl (66 kB)
Using cached urllib3-2.2.1-py3-none-any.whl (121 kB)
Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (pyproject.toml): started
  Building wheel for pyaudio (pyproject.toml): finished with status 'error'
Failed to build pyaudio

PIP STDERR
----------
  error: subprocess-exited-with-error

  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/pyaudio
      copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-311/pyaudio
      running build_ext
      building 'pyaudio._portaudio' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/src
      creating build/temp.linux-x86_64-cpython-311/src/pyaudio
      x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/local/include -I/usr/include -I/home/r8io/.local/pipx/venvs/sbapp/include -I/usr/include/python3.11 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-311/src/pyaudio/device_api.o
      src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
          9 | #include "portaudio.h"
            |          ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
markqvist commented 4 months ago

Thanks @r8io! Could you let me know if first running sudo apt install python3-pyaudio and then pip install sbapp -U (or pipx upgrade sbapp) will resolve the installation problem?

r8io commented 4 months ago

Thank you for the quick reply :-) Unfortunately it does not resolve the issue. I did sudo apt install python3-pyaudio and pipx install sbapp (not upgrade because I uninstalled sbapp version 0.8.5 before). And still get the following error message:

r8io@xx: $ pipx install sbapp
Fatal error from pip prevented installation. Full pip output in file:
    /home/r8io/.local/pipx/logs/cmd_2024-06-07_14.46.11_pip_errors.log

pip failed to build package:
    pyaudio

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
    error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

Error installing sbapp.
markqvist commented 4 months ago

Thanks. Can confirm this behaviour on a fresh install of Debian 12.

It seems that the problem here is that pipx cannot use Python dist-packages, even though they are available on the system (ie., installed via the system package manager). Since the pyaudio package has no pre-built binary distributions available via the PyPi repositories, pipx fails to resolve that dependency, even though it is actually installed on the system.

Why pipx acts like this, I have no idea about. I get the whole "isolated environment" thing, but not even being able to use dist-packages is a strange choice, I think.

Either way, if you really want to use pipx instead of just plain pip install sbapp --break-system-packages, you just need to install the build-essential package and PortAudio header files, then pipx can build everything needed from source:

sudo apt install build-essential portaudio19-dev

Thanks for finding and reporting this, I'll add it to the readme. I'll close this as resolved, but feel free to add any additional comments or notes.

r8io commented 4 months ago

Now it works! I already sent some voice messages. Amazing stuff! Thank you for explaining what went wrong. I went the pipx route and had to install portaudio19-dev (portaudio19-dec was not available).

Just to recap. To install Sideband 0.9.0 on Debian 12 with pipx I had to:

sudo apt install build-essential python3-pyaudio portaudio19-dev
pipx sbapp
markqvist commented 4 months ago

Hah, sorry for the -dec, that was just me typing too fast and not noticing the typo! Glad you got it working! And thanks for reporting it - good to have it documented so others don't run into the same issue.