bablokb / pi-webradio

An Internet-Radio built around a Waveshare 7.9" Display
GNU General Public License v3.0
12 stars 3 forks source link

Installation Problem - No module named 'sseclient' #9

Open KirbyJames opened 1 week ago

KirbyJames commented 1 week ago

Hi, I've just tried installing the latest version of pi-webradio on a Raspberry Pi 4B runing a clean installation of the 64-bit OS with the graphical UI.

When I run the install script as is, it fails during the install pip3 packages step, reporting

"error: externally-managed-environment"

I then set up a virtual envronment, and explictly used the virtual environment's pip3, this reports

"Requirement already satisfied: sseclient-py in /home/pi/radio_env/lib/python3.11/site-packages (1.8.0)"

However when I run pi-webradio it reports

pi-webradio.py -l Traceback (most recent call last): File "/usr/local/bin/pi-webradio.py", line 27, in from webradio import * File "/usr/local/bin/../lib/webradio/init.py", line 24, in from . SRRadioClient import RadioClient as RadioClient File "/usr/local/bin/../lib/webradio/SRRadioClient.py", line 16, in import sseclient ModuleNotFoundError: No module named 'sseclient'

I'm unsure what is causing this problem - I'll try reverting to a 32 bit OS to see whether that works.

KirbyJames commented 1 week ago

I get exactly the same problem with Raspberry Pi OS (32-bit)

Setting up mpg123 (1.31.2-1) ...
update-alternatives: using /usr/bin/mpg123.bin to provide /usr/bin/mpg123 (mpg123) in auto mode
update-alternatives: using /usr/bin/mpg123.bin to provide /usr/bin/mp3-decoder (mp3-decoder) in auto mode
Processing triggers for libc-bin (2.36-9+rpt2+deb12u8) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for mailcap (3.70+nmu1) ...
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.

    For more information visit http://rptl.io/venv
bablokb commented 6 days ago

Thanks for reporting this. I have many python-projects and I think it is the time to rework the installation routines... My problem is that I create and install things and then never touch the systems, so I don't run into these kind of problems.

The call to pi-webradio.py does not pick up the virtual environment. A real fix is of course my task, but you could try the following:

If this works, you can also replace the first line with a full path to the python3 interpreter of your virtual environment, which is /path/to/your/virt-env/bin/python3. This is of course a hack and not a real solution. I have to think about how I will implement this for the final solution.

KirbyJames commented 6 days ago

Thanks for getting back.

I've changed the first line in both pi-webradio.py and webradio_cli.py to point to python3 in my virtual environment. I had to install the modules - flask, requests, and evdev - to make them run.

pi-webradio.py responds correctly to pi-webradio.py -l and pi-webradio.py -p 5 (admitedly with very low volume) but after installing and starting it as a service I get no response to web requests (i.e. it timeouts).

I've tried webradio_cli.py - it runs but fails to respond to any keyboard commands e.g.

webradio_cli.py -k -e -o
echo -e "radio_on\n radio_play_channel nr=7" | webradio_cli.py

Any suggestions appreciated.

bablokb commented 6 days ago

What you can do is start the server manually (the -d will force debug-mode): pi-webradio.py -d. This might give you some more insights. Maybe you will have to stop the service first (sudo systemctl stop pi-webradio).

You could also check your system-message log for errors. (sudo journalctrl -b -g webradio will browse and grep since last boot). Messages of the service should go here. If it is still running, you can also see the status and messages with sudo systemctl -l status pi-webradio.service.

Regarding the low volume: is it also low if you call mpg123 directly, e.g. mpg123 http://.... with the URL pointing to the radio-station?