MLB-LED-Scoreboard / mlb-led-scoreboard

An LED scoreboard for Major League Baseball :baseball:
GNU General Public License v3.0
576 stars 102 forks source link

Just set up the hardware and I have an issue starting the software #510

Closed gotopes closed 5 months ago

gotopes commented 5 months ago

This issue is a

help request

Hardware Configuration

sudo python3 main.py --led-gpio-mapping="adafruit-hat"

This is what resulted:

Traceback (most recent call last): File "/home/pi/mlb-led-scoreboard/main.py", line 3, in from data.screens import ScreenType File "/home/pi/mlb-led-scoreboard/data/init.py", line 5, in from data import status File "/home/pi/mlb-led-scoreboard/data/status.py", line 1, in from data.scoreboard.inning import Inning File "/home/pi/mlb-led-scoreboard/data/scoreboard/init.py", line 1, in from data.game import Game File "/home/pi/mlb-led-scoreboard/data/game.py", line 5, in import statsapi ModuleNotFoundError: No module named 'statsapi'

=============

I am not a Pi expert (just a follow the instructions person) but I sense not all the needed modules were installed. install.sh took about 5 mins when the instructions said it should be 10-15 mins. I figured it might be because the 4B is faster than other Pi's.

Thanks for any help.

WardBrian commented 5 months ago

Have you tried re-running the install.sh script? It should be safe to repeat it

gotopes commented 5 months ago

ok, i tried reinstalling. here's all the stuff i saw on my SSH terminal. i'd say install.sh only took about 2 mins and trying to run after the install gave the same problem I had last night.

my Python version is 3.11.2

$ sudo ./install.sh


Installing python 3...

Hit:1 http://deb.debian.org/debian bookworm InRelease Hit:2 http://deb.debian.org/debian-security bookworm-security InRelease Hit:3 http://archive.raspberrypi.com/debian bookworm InRelease Hit:4 http://deb.debian.org/debian bookworm-updates InRelease Reading package lists... Done Reading package lists... Done Building dependency tree... Done Reading state information... Done Note, selecting 'python3-pil' instead of 'python3-pillow' Note, selecting 'libxslt1-dev' instead of 'libxslt-dev' python3-dev is already the newest version (3.11.2-1+b1). python3-pip is already the newest version (23.0.1+dfsg-1+rpt1). python3-pil is already the newest version (9.4.0-1.1+b1). python3-tk is already the newest version (3.11.2-3). libxml2-dev is already the newest version (2.9.14+dfsg-1.3~deb12u1). libxslt1-dev is already the newest version (1.1.35-1). libsdl2-mixer-2.0-0 is already the newest version (2.6.2+dfsg-2). libsdl2-image-2.0-0 is already the newest version (2.6.3+dfsg-1). libsdl2-2.0-0 is already the newest version (2.26.5+dfsg-1). libsdl2-ttf-2.0-0 is already the newest version (2.20.1+dfsg-2). libopenjp2-7 is already the newest version (2.5.0-2). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


Installing dependencies...

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

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. Running rgbmatrix installation... mkdir: cannot create directory ‘submodules’: File exists fatal: destination path 'matrix' already exists and is not an empty directory. Already up to date. make -C ./lib make[1]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make[1]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make -C examples-api-use make[1]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/examples-api-use' make -C ../lib make[2]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make[2]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make[1]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/examples-api-use' make -C bindings/python build make[1]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/bindings/python' make -C ../../lib make[2]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make[2]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' /usr/bin/python3 setup.py build --build-lib . make[1]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/bindings/python' make -C ./lib make[1]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make[1]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make -C examples-api-use make[1]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/examples-api-use' make -C ../lib make[2]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make[2]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make[1]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/examples-api-use' make -C bindings/python build make[1]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/bindings/python' make -C ../../lib make[2]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' make[2]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/lib' /usr/bin/python3 setup.py build --build-lib . make[1]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/bindings/python' make -C bindings/python install make[1]: Entering directory '/home/pi/mlb-led-scoreboard/submodules/matrix/bindings/python' /usr/bin/python3 setup.py install /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /usr/lib/python3/dist-packages/setuptools/command/easy_install.py:146: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( zip_safe flag not set; analyzing archive contents... rgbmatrix.pycache.core.cpython-311: module references file rgbmatrix.pycache.graphics.cpython-311: module references file make[1]: Leaving directory '/home/pi/mlb-led-scoreboard/submodules/matrix/bindings/python'

=================================================================================== If you have custom configurations, colors, or coordinates, it's recommended to update them with the latest options at this time.

This operation is automatic and will ensure you have up-to-date configuration.

This action will NOT override any custom configuration you already have unless the option has been obsoleted and is no longer in use.

Would you like to do this now? [Y/n] Installation finished!

$ python3 version.py MLB LED Scoreboard v7.0.0

$ sudo python3 main.py --led-gpio-mapping="adafruit-hat" Traceback (most recent call last): File "/home/pi/mlb-led-scoreboard/main.py", line 3, in from data.screens import ScreenType File "/home/pi/mlb-led-scoreboard/data/init.py", line 5, in from data import status File "/home/pi/mlb-led-scoreboard/data/status.py", line 1, in from data.scoreboard.inning import Inning File "/home/pi/mlb-led-scoreboard/data/scoreboard/init.py", line 1, in from data.game import Game File "/home/pi/mlb-led-scoreboard/data/game.py", line 5, in import statsapi ModuleNotFoundError: No module named 'statsapi'

WardBrian commented 5 months ago

Oh yeah, the “externally managed” error. This is new in recent OS versions. I think some people have used that --break-system-packages flag (despite its scary name, it won’t break things in our experience) but we’ve also been meaning to update the installer so it does use a virtual environment

gotopes commented 5 months ago

ok, where do i add the break-system-packages flag? i did it on the install.sh command from the install instructions and it gave an error that it was not a valid command-line parameter.

do i need to edit install.sh? i don't understand the file entirely, but i see a section commented "installing dependancies" and some lines that have the word 'install' so do i need to put the --break-system-packages flag in each of those 3 lines using the nano editor?

WardBrian commented 5 months ago

If you'd like to go that route, you can run

sudo python3 -m pip install -r requirements.txt --break-system-packages

No need to exit install.sh. We will either edit it ourselves or come up with some alternative solution, hopefully before spring training starts!

gotopes commented 5 months ago

thanks! it is looking much better, imho, and after running your command it seemed like modules were downloading/installing, ended up with two yellow color warnings that seemed informative, and then ran the launch command and got a weather API key message as i'd expect for not having grabbed the key yet. now that the software seems to be launching fine with no fatal errors, i plan on re-hooking up my 64x32 matrix and check for display and add more display-related flags to the launching command.

here is what i saw on my SSH connection terminal:

$ sudo python3 -m pip install -r requirements.txt --break-system-packages

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting feedparser==6.0.10 Downloading https://www.piwheels.org/simple/feedparser/feedparser-6.0.10-py3-none-any.whl (81 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 81.1/81.1 kB 351.8 kB/s eta 0:00:00 Collecting MLB_StatsAPI>=1.6.1 Downloading https://www.piwheels.org/simple/mlb-statsapi/MLB_StatsAPI-1.7.1-py3-none-any.whl (30 kB) Collecting pyowm==3.3.0 Downloading pyowm-3.3.0-py3-none-any.whl (4.5 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 832.5 kB/s eta 0:00:00 Collecting RGBMatrixEmulator>=0.8.4 Downloading https://www.piwheels.org/simple/rgbmatrixemulator/RGBMatrixEmulator-0.10.0-py3-none-any.whl (51 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.3/51.3 kB 240.3 kB/s eta 0:00:00 Collecting tzlocal==4.2 Downloading https://www.piwheels.org/simple/tzlocal/tzlocal-4.2-py3-none-any.whl (19 kB) Collecting sgmllib3k Downloading https://www.piwheels.org/simple/sgmllib3k/sgmllib3k-1.0.0-py3-none-any.whl (7.1 kB) Requirement already satisfied: requests<3,>=2.20.0 in /usr/lib/python3/dist-packages (from pyowm==3.3.0->-r requirements.txt (line 15)) (2.28.1) Collecting geojson<3,>=2.3.0 Downloading https://www.piwheels.org/simple/geojson/geojson-2.5.0-py2.py3-none-any.whl (14 kB) Collecting PySocks<2,>=1.7.1 Downloading https://www.piwheels.org/simple/pysocks/PySocks-1.7.1-py3-none-any.whl (16 kB) Collecting pytz-deprecation-shim Downloading https://www.piwheels.org/simple/pytz-deprecation-shim/pytz_deprecation_shim-0.1.0.post0-py2.py3-none-any.whl (15 kB) Collecting bdfparser<=2.2.0 Downloading https://www.piwheels.org/simple/bdfparser/bdfparser-2.2.0-py3-none-any.whl (12 kB) Requirement already satisfied: pygame<3,>=2.0.1 in /usr/lib/python3/dist-packages (from RGBMatrixEmulator>=0.8.4->-r requirements.txt (line 16)) (2.1.2) Collecting tornado>=6.1 Downloading tornado-6.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (435 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 435.9/435.9 kB 845.2 kB/s eta 0:00:00

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/libsixel-python/

Collecting libsixel-python>=0.5.0 Downloading https://www.piwheels.org/simple/libsixel-python/libsixel_python-0.5.0-py3-none-any.whl (14 kB) Collecting Pillow>=10.0.1 Downloading pillow-10.2.0-cp311-cp311-manylinux_2_28_aarch64.whl (4.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 842.4 kB/s eta 0:00:00 Collecting tzdata Downloading https://www.piwheels.org/simple/tzdata/tzdata-2023.4-py2.py3-none-any.whl (346 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 346.6/346.6 kB 140.0 kB/s eta 0:00:00 Installing collected packages: sgmllib3k, libsixel-python, geojson, tzdata, tornado, PySocks, Pillow, MLB_StatsAPI, feedparser, bdfparser, RGBMatrixEmulator, pytz-deprecation-shim, tzlocal, pyowm Attempting uninstall: Pillow Found existing installation: Pillow 9.4.0 Not uninstalling pillow at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'Pillow'. No files were found to uninstall. Successfully installed MLB_StatsAPI-1.7.1 Pillow-10.2.0 PySocks-1.7.1 RGBMatrixEmulator-0.10.0 bdfparser-2.2.0 feedparser-6.0.10 geojson-2.5.0 libsixel-python-0.5.0 pyowm-3.3.0 pytz-deprecation-shim-0.1.0.post0 sgmllib3k-1.0.0 tornado-6.4 tzdata-2023.4 tzlocal-4.2

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv


$ sudo python3 main.py --led-gpio-mapping="adafruit-hat"

Suggestion: to slightly improve display update, add isolcpus=3 at the end of /boot/cmdline.txt and reboot (see README.md) WARNING (19:20:04): [WEATHER] The API key provided doesn't appear to be valid. Please check your config.json. WARNING (19:20:04): [WEATHER] You can get a free API key by visiting https://home.openweathermap.org/users/sign_up