# Scroll phat : ImportError: No module named 'scrollphat'

**URL:** <https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560>\
**Category:** Raspberry Pi\
**Created:** [April 18, 2018, 12:33pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560 "2018-04-18T12:33:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 12:33pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/1 "2018-04-18T12:33:12Z")

</div>

Good Afternoon,

I’m running the latest Google AIY image `aiyprojects-2018-04-13` .

Both python2 and python3 are installed.

The latest Pimoroni dashboard is also installed along with the latest libraries.

However when I run: `python3 test-all.py` I get:

> Traceback (most recent call last):  
> File “test-all.py”, line 7, in   
> import scrollphat  
> ImportError: No module named ‘scrollphat’

Running `python test-all.py` gets me:

> Traceback (most recent call last):  
> File “test-all.py”, line 7, in   
> import scrollphat  
> File “/usr/lib/python2.7/dist-packages/scrollphat/ **init**.py”, line 20, in   
> controller = IS31FL3730(smbus, font)  
> File “/usr/lib/python2.7/dist-packages/scrollphat/IS31FL3730.py”, line 17, in **init**  
> self.bus = self.bus.SMBus(1)  
> IOError: [Errno 2] No such file or directory

Anyone got any clues.

Oh, I tried to clone the repo also, to the same end.

Cheers,

Simon.

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 1:16pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/2 "2018-04-18T13:16:47Z")

</div>

Looks like you don’t have i2c enabled, and the Python3 module for Scroll pHAT isn’t installed;

```auto
sudo apt install python3-scrollphat

```

Then enable i2c in:

```auto
sudo raspi-config

```

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 1:25pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/3 "2018-04-18T13:25:31Z")

</div>

Thanks for the quick reply.

All of that has been done, and I get the same response:

> pi@HAL9000:~ $ sudo apt install python3-scrollphat

> Reading package lists… Done  
> Building dependency tree  
> Reading state information… Done  
> python3-scrollphat is already the newest version (0.0.7).  
> 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

> pi@HAL9000:~/Pimoroni/scroll-phat/examples $ python3 test-all.py

> Traceback (most recent call last):  
> File “test-all.py”, line 7, in   
> import scrollphat  
> ImportError: No module named ‘scrollphat’

Oddly, it is not throwing an error at the:

> import math  
> import sys  
> import time

Any ideas?

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 1:29pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/4 "2018-04-18T13:29:01Z")

</div>

Just checked the ‘PiGlow’ scripts.

Same deal:

> pi@HAL9000:~/Pimoroni/piglow/examples $ python3 bar.py  
> Traceback (most recent call last):  
> File “bar.py”, line 5, in   
> import piglow  
> ImportError: No module named ‘piglow’

Yet the python games work OK.

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 1:29pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/5 "2018-04-18T13:29:40Z")

</div>

What does `python3 --version` say?

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 1:31pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/6 "2018-04-18T13:31:31Z")

</div>

May also be worth checking:

`python3 -c "import sys;print(sys.path)"`

and

`dpkg -L python3-scrollphat`

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 1:36pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/7 "2018-04-18T13:36:01Z")

</div>

Here you go…

> pi@HAL9000:~ $ python3 --version  
> Python 3.5.3

> pi@HAL9000:~ $ python3 -c “import sys;print(sys.path)”  
> [‘’, ‘/usr/lib/python35.zip’, ‘/usr/lib/python3.5’, ‘/usr/lib/python3.5/plat-arm-linux-gnueabihf’, ‘/usr/lib/python3.5/lib-dynload’, ‘/usr/local/lib/python3.5/dist-packages’, ‘/opt/aiy/projects-python/src’, ‘/usr/lib/python3/dist-packages’]

> pi@HAL9000:~ $ dpkg -L python3-scrollphat  
> /.  
> /usr  
> /usr/share  
> /usr/share/doc  
> /usr/share/doc/python3-scrollphat  
> /usr/share/doc/python3-scrollphat/changelog.gz  
> /usr/share/doc/python3-scrollphat/copyright  
> /usr/lib  
> /usr/lib/python3  
> /usr/lib/python3/dist-packages  
> /usr/lib/python3/dist-packages/scrollphat-0.0.7.egg-info  
> /usr/lib/python3/dist-packages/scrollphat-0.0.7.egg-info/top\_level.txt  
> /usr/lib/python3/dist-packages/scrollphat-0.0.7.egg-info/PKG-INFO  
> /usr/lib/python3/dist-packages/scrollphat-0.0.7.egg-info/dependency\_links.txt  
> /usr/lib/python3/dist-packages/scrollphat  
> /usr/lib/python3/dist-packages/scrollphat/ **init**.py  
> /usr/lib/python3/dist-packages/scrollphat/IS31FL3730.py  
> /usr/lib/python3/dist-packages/scrollphat/font.py

Do I need to add a path somewhere?

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 1:38pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/8 "2018-04-18T13:38:17Z")

</div>

These are pretty much identical to what I see on my local system. Python is the same version, and it has `'/usr/lib/python3/dist-packages'` in its path.

What happens if you:

```auto
python3 -c "import scrollphat"

```

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 1:40pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/9 "2018-04-18T13:40:43Z")

</div>

Same error unfortunately:

> pi@HAL9000:~ $ python3 -c “import scrollphat”  
> Traceback (most recent call last):  
> File “”, line 1, in   
> ImportError: No module named ‘scrollphat’

This is a completely fresh install of the OS too, so no tinkering by myself.

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 1:47pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/10 "2018-04-18T13:47:21Z")

</div>

I wonder if the files are simply broken. Filesystem corruption or otherwise?

You could prod at them with `cat /usr/lib/python3/dist-packages/scrollphat/ __init__.py` etc. but I suspect that might just be a waste of time.

This could be worth a try:

```nohighlight
sudo apt remove --purge python3-scrollphat
sudo apt install python3-scrollphat

```

Edit: ^ just flipped the above two commands, I put them in reverse order :D

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 1:53pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/11 "2018-04-18T13:53:35Z")

</div>

> [@anon83280986](#):
>
> ‘/opt/aiy/projects-python/src’,

Also noticed the above in your `sys.path`, might be worth checking if this directory exists since I’m not sure what Python will do if it doesn’t.

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 1:55pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/12 "2018-04-18T13:55:12Z")

</div>

So, I purged and reinstalled.

Getting a different set of errors now:

> pi@HAL9000:~/Pimoroni/scroll-phat/examples $ python3 test-all.py  
> Traceback (most recent call last):  
> File “test-all.py”, line 7, in   
> import scrollphat  
> File “/usr/lib/python3/dist-packages/scrollphat/ **init**.py”, line 20, in   
> controller = IS31FL3730(smbus, font)  
> File “/usr/lib/python3/dist-packages/scrollphat/IS31FL3730.py”, line 17, in **init**  
> self.bus = self.bus.SMBus(1)  
> FileNotFoundError: [Errno 2] No such file or directory

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 1:55pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/13 "2018-04-18T13:55:36Z")

</div>

Ah, so it was corrupt.

Enable i2c as mentioned above: `sudo raspi-config`

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 1:57pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/14 "2018-04-18T13:57:31Z")

</div>

ooh. no, that directory doesn’t exist, it’s:

`> /home/pi/AIY-projects-python/src`

How do I change it?

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 1:59pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/15 "2018-04-18T13:59:36Z")

</div>

The i2c is enabled.

I’ve checked via both CLI and GUI.

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 2:03pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/16 "2018-04-18T14:03:25Z")

</div>

You can check if i2c is actually enabled by looking at:

```auto
ls /dev/i2c*
dmesg | grep i2c
lsmod | grep i2c
cat /boot/config.txt | grep i2c

```

You should see output like this:

```nohighlight
pi@raspberrypi:~ $ ls /dev/i2c*
/dev/i2c-1

pi@raspberrypi:~ $ dmesg | grep i2c
[2.685060] i2c /dev entries driver

pi@raspberrypi:~ $ lsmod | grep i2c
i2c_bcm2835 16384 0
i2c_dev 16384 0

pi@raspberrypi:~ $ cat /boot/config.txt | grep i2c
dtparam=i2c_arm=on

```

There’s a good chance if that one package was corrupt that more could be wrong with your system, you should probably re-image it.

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 2:08pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/17 "2018-04-18T14:08:39Z")

</div>

Does this mean i2c is alive or not?

> pi@HAL9000:~ $ ls /dev/i2c\*  
> ls: cannot access ‘/dev/i2c\*’: No such file or directory

> pi@HAL9000:~ $ dmesg | grep i2c  
> [2.411193] i2c /dev entries driver

> pi@HAL9000:~ $ lsmod | grep i2c  
> i2c\_dev 6913 0

> pi@HAL9000:~ $ cat /boot/config.txt | grep i2c  
> dtparam=i2c\_arm=on

I can go back to an older image if needed, but I never used any Hats with that, so don’t know if I’ll have similar issues.

Worth a try though.

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [April 18, 2018, 2:13pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/18 "2018-04-18T14:13:25Z")

</div>

Looks like the `i2c_bcm2835` module is missing there, which wont help. Possibly suffered the same fate as Scroll pHAT.

You _may_ be able to recover with a kernel reinstall:

```auto
sudo apt update
sudo apt upgrade
sudo apt install --reinstall raspberrypi-bootloader raspberrypi-kernel

```

---

<div class="post-metadata">

**Author:** ![anon83280986](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@anon83280986](https://forums.pimoroni.com/u/anon83280986)\
**Post date:** [April 18, 2018, 2:30pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/19 "2018-04-18T14:30:01Z")

</div>

OK, so that got the i2c interface running.

Now I’m getting smbus errors.

> pi@HAL9000:~/Pimoroni/scroll-phat/examples $ ls /dev/i2c\*  
> /dev/i2c-1

> pi@HAL9000:~/Pimoroni/scroll-phat/examples $ dmesg | grep i2c  
> [2.468308] i2c /dev entries driver

> pi@HAL9000:~/Pimoroni/scroll-phat/examples $ lsmod | grep i2c  
> i2c\_bcm2835 16384 0  
> i2c\_bcm2708 16384 0  
> i2c\_dev 16384 0

> pi@HAL9000:~/Pimoroni/scroll-phat/examples $ cat /boot/config.txt | grep i2c  
> dtparam=i2c\_arm=on

> pi@HAL9000:~/Pimoroni/scroll-phat/examples $ python3 test-all.py  
> Traceback (most recent call last):  
> File “test-all.py”, line 7, in   
> import scrollphat  
> File “/usr/lib/python3/dist-packages/scrollphat/ **init**.py”, line 20, in   
> controller = IS31FL3730(smbus, font)  
> File “/usr/lib/python3/dist-packages/scrollphat/IS31FL3730.py”, line 21, in **init**  
> self.set\_mode(self.i2cConstants.MODE\_5X11)  
> File “/usr/lib/python3/dist-packages/scrollphat/IS31FL3730.py”, line 62, in set\_mode  
> self.bus.write\_i2c\_block\_data(self.i2cConstants.I2C\_ADDR, self.i2cConstants.CMD\_SET\_MODE, [self.i2cConstants.MODE\_5X11])  
> OSError: [Errno 121] Remote I/O error

Think I’m going to revert to an older image, see how that goes.

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [April 18, 2018, 2:39pm UTC](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560/20 "2018-04-18T14:39:20Z")

</div>

I did have an issue getting scrollphat up and running on the AIY image way back when it was first released. Not sure if it’s the same issue: [https://github.com/pimoroni/scroll-phat/issues/73](https://github.com/pimoroni/scroll-phat/issues/73)

[Next page](https://forums.pimoroni.com/t/scroll-phat-importerror-no-module-named-scrollphat/7560.md?page=2)
