# Weather hat software errors

**URL:** <https://forums.pimoroni.com/t/weather-hat-software-errors/22213>\
**Category:** Raspberry Pi\
**Created:** [May 22, 2023, 6:18pm UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213 "2023-05-22T18:18:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamachine](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jamachine](https://forums.pimoroni.com/u/jamachine)\
**Post date:** [May 22, 2023, 6:18pm UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213/1 "2023-05-22T18:18:02Z")

</div>

Hello ,

Really new to raspi, i followed all of the install of software the hello world works and button test but nothing else just installed the os today and updated and this is what i get

Traceback (most recent call last):  
File “/home/duh/weatherhat-python/examples/weather.py”, line 13, in   
import weatherhat  
File “/home/duh/.local/lib/python3.9/site-packages/weatherhat/ **init**.py”, line 6, in   
import ioexpander as io  
File “/home/duh/.local/lib/python3.9/site-packages/ioexpander/ **init**.py”, line 3, in   
from smbus2 import SMBus, i2c\_msg  
can anybody help me

---

<div class="post-metadata">

**Author:** ![ahnlak](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/ahnlak/32/5610_2.png) [@ahnlak](https://forums.pimoroni.com/u/ahnlak)\
**Post date:** [May 24, 2023, 11:02am UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213/2 "2023-05-24T11:02:48Z")

</div>

Unfortunately, you’ve clipped off the first line of that error message that would have told us what the problem actually is, but at a guess… have you enabled i2c on your Pi?

---

<div class="post-metadata">

**Author:** ![jamachine](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jamachine](https://forums.pimoroni.com/u/jamachine)\
**Post date:** [May 24, 2023, 3:05pm UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213/3 "2023-05-24T15:05:29Z")

</div>

Thanks for the reply

But that is all that it shows

Here is line it is referring to

#!/usr/bin/env python3  
import math  
import pathlib  
import time

import yaml

import RPi.GPIO as GPIO  
import ST7789  
from fonts.ttf import ManropeBold as UserFont  
from PIL import Image, ImageDraw, ImageFont

import weatherhat this is line 13  
from weatherhat import history

Thanks Stan

---

<div class="post-metadata">

**Author:** ![ahnlak](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/ahnlak/32/5610_2.png) [@ahnlak](https://forums.pimoroni.com/u/ahnlak)\
**Post date:** [May 24, 2023, 3:40pm UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213/4 "2023-05-24T15:40:48Z")

</div>

There should have been an actual error message after the traceback block you posted - something along the lines of `OSError:` or `RuntimeError:`.

The traceback is great for telling us _where_ the problem happened, but it makes diagnosis a lot easier when we know _what_ happened too :-)

Given you have things like Hello World working, the most likely remains a failure to enable i2c - the installer usually does it for you, but double check in `raspi-config`, under `Interfacing Options`

---

<div class="post-metadata">

**Author:** ![jamachine](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jamachine](https://forums.pimoroni.com/u/jamachine)\
**Post date:** [May 24, 2023, 4:20pm UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213/5 "2023-05-24T16:20:39Z")

</div>

> 

```
from smbus2 import SMBus, i2c_msg

```

ModuleNotFoundError: No module named ‘smbus2’

> > >

here is what i just did

duh@weather:~ $ sudo i2cdetect -y 1  
0 1 2 3 4 5 6 7 8 9 a b c d e f  
00: – – – – – – – –  
10: – – 12 – – – – – – – – – – – – –  
20: – – – 23 – – – – – – – – – – – –  
30: – – – – – – – – – – – – – – – –  
40: – – – – – – – – – – – – – – – –  
50: – – – – – – – – – – – – – – – –  
60: – – – – – – – – – – – – – – – –  
70: – – – – – – 76 –  
duh@weather:~ $ sudo apt-get install python-smbus  
Reading package lists… Done  
Building dependency tree… Done  
Reading state information… Done  
Package python-smbus is not available, but is referred to by another package.  
This may mean that the package is missing, has been obsoleted, or  
is only available from another source

E: Package ‘python-smbus’ has no installation candidate  
duh@weather:~ $ import smbus  
bash: import: command not found  
Thanks Stan

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [May 24, 2023, 4:35pm UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213/6 "2023-05-24T16:35:30Z")

</div>

Try

`python3 -m pip install smbus2`

:)

---

<div class="post-metadata">

**Author:** ![jamachine](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jamachine](https://forums.pimoroni.com/u/jamachine)\
**Post date:** [May 24, 2023, 5:09pm UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213/7 "2023-05-24T17:09:08Z")

</div>

well that solved that but now i get this

Traceback (most recent call last):  
File “/home/duh/weatherhat-python/examples/weather.py”, line 740, in   
main()  
File “/home/duh/weatherhat-python/examples/weather.py”, line 709, in main  
sensordata = SensorData()  
File “/home/duh/weatherhat-python/examples/weather.py”, line 649, in **init**  
self.sensor = weatherhat.WeatherHAT()  
File “/usr/local/lib/python3.9/dist-packages/weatherhat/ **init**.py”, line 81, in **init**  
self.\_ioe.on\_interrupt(self.handle\_ioe\_interrupt)  
File “/usr/local/lib/python3.9/dist-packages/ioexpander/ **init**.py”, line 410, in on\_interrupt  
self.\_gpio.add\_event\_detect(self.\_interrupt\_pin, self.\_gpio.FALLING, callback=callback, bouncetime=1)  
RuntimeError: Failed to add edge detection

> > >

Thanks Stan

---

<div class="post-metadata">

**Author:** ![jamachine](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jamachine](https://forums.pimoroni.com/u/jamachine)\
**Post date:** [May 24, 2023, 5:39pm UTC](https://forums.pimoroni.com/t/weather-hat-software-errors/22213/8 "2023-05-24T17:39:16Z")

</div>

Thanks Everybody went and reinstalled the hat and it now works

Thanks Stan
