vicwomg / pikaraoke

Youtube-based Karaoke machine for Raspberry Pi, OSX, Windows, and Linux
511 stars 135 forks source link

[BUG] Not starting on rpi 400 latest raspberry pi OS #347

Closed monteslu closed 3 months ago

monteslu commented 3 months ago

Describe the bug

Error running on rpi 400 latest raspberry pi OS fully updated

pi@rp400:~/pikaraoke $ ./pikaraoke.sh
Traceback (most recent call last):
  File "/home/pi/pikaraoke/app.py", line 20, in <module>
    from selenium import webdriver
  File "/home/pi/pikaraoke/.venv/lib/python3.11/site-packages/selenium/webdriver/__init__.py", line 20, in <module>
    from .chrome.webdriver import WebDriver as Chrome  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/pikaraoke/.venv/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 18, in <module>
    from selenium.webdriver.chromium.webdriver import ChromiumDriver
  File "/home/pi/pikaraoke/.venv/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 22, in <module>
    from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
  File "/home/pi/pikaraoke/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 67, in <module>
    from .websocket_connection import WebSocketConnection
  File "/home/pi/pikaraoke/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/websocket_connection.py", line 23, in <module>
    from websocket import WebSocketApp
ModuleNotFoundError: No module named 'websocket'

To Reproduce Steps to reproduce the behavior:

  1. Install latest rasperry pi OS
  2. run setup
  3. launch
  4. See error

Expected behavior Should load server and fire up browser

Screenshots If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

Additional context

Perhaps there can be an option to start headless and we can just fire up the browser ourselves?

q2000drum commented 3 months ago

Hello Luis, I followed the same process on a PI 4B and got the same results. Any help from the developer would be appreciated.

monteslu commented 3 months ago

temporary workaround until this gets fixed in app.py comment out:

# from selenium import webdriver
# from selenium.webdriver.chrome.options import Options
# from selenium.webdriver.chrome.service import Service
# from selenium.webdriver.common.by import By
# from selenium.webdriver.common.keys import Keys
# from selenium.webdriver.support import expected_conditions as EC
# from selenium.webdriver.support.ui import WebDriverWait

and this:

    # if not args.hide_splash_screen: 
    #     if platform == "raspberry_pi":
    #         service = Service(executable_path='/usr/bin/chromedriver')
    #     else: 
    #         service = None
    #     options = Options()

    #     if args.window_size:
    #         options.add_argument("--window-size=%s" % (args.window_size))
    #         options.add_argument("--window-position=0,0")

    #     options.add_argument("--kiosk")
    #     options.add_argument("--start-maximized")
    #     options.add_experimental_option("excludeSwitches", ['enable-automation'])
    #     driver = webdriver.Chrome(service=service, options=options)
    #     driver.get(f"{k.url}/splash" )
    #     driver.add_cookie({'name': 'user', 'value': 'PiKaraoke-Host'})
    #     # Clicking this counts as an interaction, which will allow the browser to autoplay audio
    #     wait = WebDriverWait(driver, 60)
    #     elem = wait.until(EC.element_to_be_clickable((By.ID, "permissions-button")))
    #     elem.click()

It will let you launch the server, then you can open the browser to the URL it shows you on the command line.

vicwomg commented 3 months ago

This was fixed a couple of days ago. It's a selenium release incompatibility. A git pull and rerun of ./setup.sh of the latest master branch should address the issue.

To check, ensure requirements.txt contains selenium==4.21.0 if not, you need to pull the update and rerun setup

vicwomg commented 3 months ago

Perhaps there can be an option to start headless and we can just fire up the browser ourselves?

There is: ./pikaraoke.sh --headless

See ./pikaraoke.sh --help for all options

vicwomg commented 3 months ago

dup of #346