0

I'm currently trying to do the project made by Dennis Mellican about using a raspberry Pi with the lego dimension platform. He made a step by step guide here https://codeburst.io/my-lego-minifigures-play-spotify-dc397e83280e . I managed to get to the step ./install.sh but i get this error :

(venv) pi@raspberrypi:~/musicfig $ ./install.sh
[INFO] Checking Python version...
[INFO] Retrieve app updates
[INFO] Already up to date.
[INFO] Installing apt-get packages...
E: Unable to locate package python-usb
[ERROR] on line 106

In the github install.sh code available here https://github.com/meltaxa/musicfig/blob/master/install.sh I've found the line in cause here :

sudo apt-get -y -qq install python-usb mpg123

I tried to install either libusb or pyusb manually but I always end with the same message. I'm lost on how to solve this issue. I'm using a raspberry PI 3 model B+ with the os Raspberry PI OS (64 -bit).

1
  • I used Raspberry PI Imager v1.8.5 to install Raspberry PI OS (64-bit). For the version it is bookworm version 12.
    – loic
    May 14 at 16:42

3 Answers 3

0

ok I found a working solution with bullseye as base instead of bookworm (I use docker so I don't need to mess with the base software of the rpi)

Install jukebox

use bullseye for the rpi as base (rpi imager)

    sudo apt update
    sudo apt upgrade
    sudo apt install apt-transport-https ca-certificates curl gnupg vim
    curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian bullseye stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt update
    sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
    sudo usermod -aG docker ${USER}
    sudo reboot

*** create jukebox dir in the pi home folder ***

    mkdir jukebox
    cd jukebox
    mkdir config
    mkdir mp3
    cd config
    curl -L https://raw.githubusercontent.com/meltaxa/musicfig/master/install.sh | bash -s -- --docker
    cd ..

*** edit the config file and replace the path to the mp3 folder

I used /mp3

*** get the bus and device numbers of the lego base ***

    lsusb|grep 0e6f

*** replace "bus" and "device" with the numbers of the previous command ***

    docker run -v /home/pi/jukebox/config:/config -v /home/pi/jukebox/mp3:/mp3 -p 5000:5000 --device=/dev/bus/usb/<bus>/<device> --device=/dev/snd meltaxa/musicfig:latest

*** optional compose file to make life easier ***

create a file named compose.yml with the following content replace the values of the usb device toi the bus and device number found with the above lsusb command

    services:
      jukebox:
        image: meltaxa/musicfig:latest
        ports:
          - 5000:5000
        restart: always
        volumes:
          - ./config:/config
          - ./mp3:/mp3
          - "$HOME/.config/pulse/cookie:/root/.config/pulse/cookie"
          - "${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native"
        environment:
          - PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native
        devices:
          - /dev/bus/usb/001/005
          - /dev/snd
        group_add:
          - audio

save it and run it

docker compose up -d

7
  • That sound promising ! I'll test it tomorrow, today i didn't had time. Thanks a lot for the explanation, even if i'm completly new to the domain, i feel like it will be easily able to follow your instructions ! So normally each time i restart the raspberry i'll have to launch the command docker compose up -d ?
    – loic
    May 15 at 20:55
  • no docker is a running service and the -d makes it run as a daemon and the restart always , restarts it if it crashes and when you reboot it or pull the power it will automatically be started up again ;) (I like docker)
    – Beastie
    May 17 at 6:05
  • btw if you go the compose file way don't do the "docker run -v /home/pi/jukebox/config:/config -v /home/pi/jukebox/mp3:/mp3 -p 5000:5000 --device=/dev/bus/usb/<bus>/<device> --device=/dev/snd meltaxa/musicfig:latest", if you do you will have another one running that you will have to remove
    – Beastie
    May 17 at 6:10
  • btw if you did start it you can do 'docker ps' to see your runnig containers and the do "docker stop <container-id>" and "docker rm <container-id>" if you do 'docker ps -a' you'll see all containers even the non running ones the compose is easier go in the folder where you made compose.yml file and do "docker compose stop" " docker compose start" or if you want it removed "docker compose down" if you want to see the logs you can do docker logs --follow <container-name>
    – Beastie
    May 17 at 6:31
  • btw all data are exported in that dir with the compose file in it so destroying the container with down is ok because your data won't be gone and as soon as you do up -d the container is recreated with you data and everything is working again
    – Beastie
    May 17 at 6:37
0

You should NEVER use apt-get use apt (or you may miss vital prompts).

Install python3-usb.

0

)trying the same thing running into multiple problems install.sh gives also errors with python 3.11.2 which it detects to be a smaller number then the python 3.8.5 required

tried the docker way but that messes up on a rpi4 with bookworm

 ✔ Container jukebox  Recreated                                            0.2s
Attaching to jukebox
jukebox  | [2024-05-14 17:13:54,563] INFO: Update v1.0.9 available. Run install.sh to update.
jukebox  | [2024-05-14 17:13:55,753] INFO: Musicfig (offline mode) started.
jukebox  | [2024-05-14 17:13:55,932] INFO: Lego Dimensions base activated.
jukebox  | Exception in thread Thread-1:
jukebox  | Traceback (most recent call last):
jukebox  |   File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
jukebox  |     self.run()
jukebox  |   File "/usr/local/lib/python3.9/threading.py", line 910, in run
jukebox  |     self._target(*self._args, **self._kwargs)
jukebox  |   File "/musicfig/app/lego.py", line 112, in __init__
jukebox  |     self.base = self.startLego()
jukebox  |   File "/musicfig/app/lego.py", line 232, in startLego
jukebox  |     self.initMp3()
jukebox  |   File "/musicfig/app/lego.py", line 133, in initMp3
jukebox  |     self.p = mp3player.Player()
jukebox  |   File "/musicfig/app/mp3player.py", line 123, in __init__
jukebox  |     self.mp3 = ExtMpg123()
jukebox  |   File "/musicfig/app/mp3player.py", line 36, in __init__
jukebox  |     super().__init__(filename, library_path)
jukebox  |   File "/usr/local/lib/python3.9/site-packages/mpg123.py", line 110, in __init__
jukebox  |     self._lib = self.init_library(library_path)
jukebox  |   File "/usr/local/lib/python3.9/site-packages/mpg123.py", line 99, in init_library
jukebox  |     raise self.LibInitializationException('libmpg123 not found')
jukebox  | mpg123.Mpg123.LibInitializationException: libmpg123 not found

by the looks of it (date when image was created) python 3.9 was used so way older then bookworm, and the installation instructions, make me think it was originally made for buster (10) with a recompile of the needed python version (3.8.5) in it

if you check apt for python-usb you'll find python3-usb (but that don't work if you change the install.sh file), it will pass by it but does not work

pi@jukebox:~ $ sudo apt search python-usb
Sorting... Done
Full Text Search... Done
python3-usb/stable,stable,now 1.2.1-2 all [installed]
  USB interface for Python (Python3)
3
  • for the 3.11 part indeed i had the same issue, the tutorial of Dennis explain how to get the python 3.8.5 env here link and it worked for me exept a small error on one code line sudo ./configure --enable-optimizations is the correct one instead of sudo ./configure-enable-optimizations
    – loic
    May 14 at 18:14
  • I have done that too (same remark with the ./configure --enable-optimizations) but the code says to complain when it's not 3.8.5 or higher ans 3.11.2 is higher ;), but for the docker way that shouldnn't make a difference (I don't have to do all that) but audio has changed in bookworm and that messes it up for me
    – Beastie
    May 15 at 7:08
  • please format the error message as code ... place ``` on a blank line before the message and on a blank line after the message
    – jsotola
    May 18 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.