pimoroni / weatherhat-python

MIT License
23 stars 16 forks source link

examples not working 'weather' and 'LCD' (v 1.0.0) #34

Open bsimmo opened 2 months ago

bsimmo commented 2 months ago

So installed the new version v1.0.0 BME and averaging etc work fine.

weather.py and LCD.py do not.

Could it be NUMPY 2.0.0 ? Which I just got fixed on pywheels so we can install. #32 See my install log here

https://github.com/pimoroni/weatherhat-python/issues/33#issuecomment-2187067019

LCD error

(pimoroni) weatherhat@weatherhat:~/weatherhat-python/examples $ python lcd.py
Traceback (most recent call last):
  File "/home/weatherhat/weatherhat-python/examples/lcd.py", line 4, in <module>
    from PIL import Image, ImageDraw, ImageFont
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/PIL/Image.py", line 88, in <module>
    from . import _imaging as core
ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory

weather.py

(pimoroni) weatherhat@weatherhat:~/weatherhat-python/examples $ python weather.py
Traceback (most recent call last):
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/numpy/_core/__init__.py", line 23, in <module>
    from . import multiarray
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/numpy/_core/multiarray.py", line 10, in <module>
    from . import overrides
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/numpy/_core/overrides.py", line 8, in <module>
    from numpy._core._multiarray_umath import (
ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/numpy/__init__.py", line 114, in <module>
    from numpy.__config__ import show as show_config
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/numpy/__config__.py", line 4, in <module>
    from numpy._core._multiarray_umath import (
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/numpy/_core/__init__.py", line 49, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.11 from "/home/weatherhat/.virtualenvs/pimoroni/bin/python"
  * The NumPy version is: "2.0.0"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: libopenblas.so.0: cannot open shared object file: No such file or directory

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/weatherhat/weatherhat-python/examples/weather.py", line 10, in <module>
    import st7789
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/st7789/__init__.py", line 26, in <module>
    import numpy
  File "/home/weatherhat/.virtualenvs/pimoroni/lib/python3.11/site-packages/numpy/__init__.py", line 119, in <module>
    raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.
bsimmo commented 2 months ago

Followed the link in the error and read to this https://numpy.org/devdocs/user/troubleshooting-importerror.html#raspberry-pi

Tried sudo apt install libatlas-base-dev but that didn't help

Ran out of time for now.

Riik commented 3 weeks ago

Same issue here in RPI Zero W. Fixed this by installing two missing dependencies:

sudo apt-get install libopenblas-dev
sudo apt-get install libopenjp2-7

You can also see in the error message that it complains about not finding the binaries (.so) for those libraries. Note that those are different from libopenatlas which was already in the instructions.

I've also downgraded numpy to 1.26.4 (pip install -U numpy==1.26.4), but don't know if that was a required step to make it work.