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

various build errors #2

Open
topchyan opened this issue Mar 17, 2024 · 10 comments
Open

various build errors #2

topchyan opened this issue Mar 17, 2024 · 10 comments

Comments

@topchyan
Copy link

Building wheels for collected packages: PyAudio
  Building wheel for PyAudio (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for PyAudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [19 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/avetik/python-apps/oceaneyes/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
      In file included from src/pyaudio/device_api.c:1:
      src/pyaudio/device_api.h:7:10: fatal error: Python.h: No such file or directory
          7 | #include "Python.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
Failed to build PyAudio
ERROR: Could not build wheels for PyAudio, which is required to install pyproject.toml-based projects
install.sh: 45: source: not found
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Configuration file /lib/systemd/system/oe.service is marked executable. Please remove executable permission bits. Proceeding anyway.
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[i] Installed requirements in the venv ...
Package    Version
---------- -------
pip        23.0.1
setuptools 66.1.1
@duracell80
Copy link
Owner

Thank you for reporting the issue. Could you provide some details about the system / operating system you are using? Thanks.

@topchyan
Copy link
Author

topchyan commented Mar 20, 2024

$uname -srm
Linux 6.1.0-18-amd64 x86_64

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm

$ cat /etc/*-release
PRETTY_NAME="MX 23.2 Libretto"
DISTRIB_ID=MX
DISTRIB_RELEASE=23.2
DISTRIB_CODENAME="Libretto"
DISTRIB_DESCRIPTION="MX 23.2 Libretto"
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ sudo hostnamectl
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

@duracell80
Copy link
Owner

To resolve the PyAudio issue can you try running

sudo apt install python3-dev

and then again

./install.sh

The python venv should then report successful dependencies. MX doesn't seem to use systemd by default addressing in #1

@topchyan
Copy link
Author

Tried your suggestion of installing python3-dev and then the install script. I think the output went a bit further this time, still shown some warnings along the way, ultimately didn't work, but the same error message mentioned in #1 overlapped the shell's output, so I can't even paste it here.

@topchyan
Copy link
Author

I am playing with various python version via pyenv, but I think python3-dev installs the version that's applicable to the global version (3.11.2 currently). Any idea how to install/run oceaneyes within pyenv?

@duracell80
Copy link
Owner

I commented out the last line that replaces the shell output, if you could pull that update you should get more info. I need to look further into supporting non-systemd setups.

The script does run a venv (in ~/python-apps), based on your system python version 3.11.2 before installing the requirements. The pip in the venv/bin may be troublesome at install; I can take a closer look at that in MX Linux. Currently the target system is Linux Mint and Raspberry Pi OS. Though the Pi upgraded to Bookworm since so it would be good to update the install anyway.

python3 -m venv oceaneyes
source $DIR_APP/bin/activate

I recall a problem with the PyAudio in pypi needing that dev library so this should resolve the wheel issue:

sudo apt install python3-dev portaudio19-dev

@duracell80
Copy link
Owner

duracell80 commented Mar 21, 2024

I am playing with various python version via pyenv, but I think python3-dev installs the version that's applicable to the global version (3.11.2 currently). Any idea how to install/run oceaneyes within pyenv?

Yes you could try the following to run in the venv without the systemd service:

$ cd ~/python-apps/oceaneyes
$ source bin/activate oceaneyes
$ cd app
$ ../bin/python3 main.py

Load a browser at the address:
http://192.168.xxx.xxx:1929/docs

Replace the ipaddr with yours ( ifconfig | grep "192" )

And then after killing the script run a deactivate
$ deactivate

@topchyan
Copy link
Author

That sequence actually worked

image

@topchyan
Copy link
Author

I have a radio itself on 192.168.1.250 and attempted to try using script from the description to see how to interact with it, but it failed to find/load module oceaneyes for starters. Should I file it as a separate ticket? FastAPI docs page opens fine (but I have no idea on how to use these various buttons). Thanks!

@duracell80
Copy link
Owner

duracell80 commented Mar 21, 2024

Ah cool, it's up and running. The radio needs to be on for its web interface to be reachable.

Try clicking /v1/device/scan then click buttons "Try It Out" > "Execute". Have the terminal visible in the background. This should scan the network for the radio, but wait for it to run all the way through 255. In the terminal it will print some output:

[i] Auto detecting Skytune radios on the LAN ... 

Press Ctrl + Z when all known devices are found
Press Ctrl + C if scanning seems to be stuck

--- Tip: Take note of these numbers and then set
--- static routes on the router for these devices

INFO:root:[i] Looking for a radio at this address (192.168.1.1)
INFO:root:[i] Looking for a radio at this address (192.168.1.250) [P:80]
...
INFO:root:
[+] Found a radio @192.168.1.250:80

Make the device active by putting this in a browser address bar:
http://yourip:1929/v1/device/switch/1

Put this to get the favorites off the radio:

http://yourip:1929/v1/fav/backup

Or

http://yourip:1929/v1/fav/play/16

To play preset 16

INFO:root:[i] Request to play preset 1 on [email protected] ... checking stream
INFO:root:[i] Playing preset 16 on [email protected]
INFO:root:--- http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/nonuk/sbr_low/ak/bbc_world_service.m3u8
INFO:     192.168.1.250:60606 - "GET /v1/fav/play/16 HTTP/1.1" 200 OK

To mute and unmute copy these into a browser address bar after setting the device to 1 (I have three radios):

http://yourip:1929/v1/volume/mute
http://yourip:1929/v1/volume/unmute

I do need to update the readme for how to use the endpoints.

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

2 participants