# Trilobot module error

**URL:** <https://forums.pimoroni.com/t/trilobot-module-error/28693>\
**Category:** Support\
**Created:** [February 14, 2026, 3:59am UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693 "2026-02-14T03:59:18Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@Bryan](https://forums.pimoroni.com/u/Bryan)\
**Post date:** [February 14, 2026, 3:59am UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/1 "2026-02-14T03:59:18Z")

</div>

I loaded a fresh copy of the raspberry pi OS onto a sd card. Following your install guide all went as expected up until trying example code. The problem is any example I try to run gives me this error: No module named ‘trilobot’ How do I fix this? Where do I find the trilobot module?

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [February 14, 2026, 9:11am UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/2 "2026-02-14T09:11:20Z")

</div>

Did you do the following?

In the new terminal window type the commands exactly as it appears below (check for typos) and follow the on-screen instructions:

git clone [GitHub - pimoroni/trilobot-python](https://github.com/pimoroni/trilobot-python) cd trilobot-python ./install.sh

**Note** Libraries will be installed in the “pimoroni” virtual environment, you will need to activate it to run examples:

```auto
source ~/.virtualenvs/pimoroni/bin/activate

```

[pimoroni/trilobot-python](https://github.com/pimoroni/trilobot-python/)

---

<div class="post-metadata">

**Author:** ![Bryan](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@Bryan](https://forums.pimoroni.com/u/Bryan)\
**Post date:** [February 14, 2026, 3:13pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/3 "2026-02-14T15:13:28Z")

</div>

Yes I followed the tutorial exactly. The only problem I had prior to the example issue was running “sudo ./install.sh” Here is the error “ **FATAL: Script should not be run as root. Try ‘./install.sh’** ” So I removed sudo and ran the script, which appeared to run successfully. I answered ‘y’ to all prompts, _No Luck_. I wiped the sd card and again started from scratch. I get the same error: _**from trilobot import \*  
ModuleNotFoundError: No module named ‘trilobot’**_

How do I fix this or manually obtain the module and install it so python finds it?

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [February 14, 2026, 3:32pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/4 "2026-02-14T15:32:38Z")

</div>

IMHO, this virtual environment stuff is a PITA, but there isn’t much choice.  
Are you running the examples from command line or from an IDE like Thonny?  
Try activating the virtual environment, and running an example from a terminal window / command line.

---

<div class="post-metadata">

**Author:** ![Bryan](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@Bryan](https://forums.pimoroni.com/u/Bryan)\
**Post date:** [February 14, 2026, 4:01pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/5 "2026-02-14T16:01:18Z")

</div>

I am running from a ssh’ed terminal. It seams the virtual environment is loaded as part of the originally ran script.

---

<div class="post-metadata">

**Author:** ![Bryan](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@Bryan](https://forums.pimoroni.com/u/Bryan)\
**Post date:** [February 14, 2026, 6:02pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/6 "2026-02-14T18:02:35Z")

</div>

I tried the setup example found on [githut](https://github.com/pimoroni/trilobot-python)which seems to get around the original trilobot module error only to be confronted with the following error:  
$ python3 movements.py  
Trilobot Example: Movement

Traceback (most recent call last):  
File “/home/pi/Pimoroni/trilobot/examples/movements.py”, line 13, in  
tbot = Trilobot()  
File “/home/pi/.virtualenvs/pimoroni/lib/python3.13/site-packages/trilobot/ **init**.py”, line 134, in **init**  
self.sn3218 = sn3218.SN3218()  
~~~~~~~~~~~~~ ^^  
File “/home/pi/.virtualenvs/pimoroni/lib/python3.13/site-packages/sn3218/ **init**.py”, line 26, in **init**  
self.enable\_leds(enable\_mask)  
~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^  
File “/home/pi/.virtualenvs/pimoroni/lib/python3.13/site-packages/sn3218/ **init**.py”, line 55, in enable\_leds  
self.i2c.write\_i2c\_block\_data(I2C\_ADDRESS, CMD\_ENABLE\_LEDS, [  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
enable\_mask & 0x3F,  
^^^^^^^^^^^^^^^^^^^  
(enable\_mask \>\> 6) & 0x3F,  
^^^^^^^^^^^^^^^^^^^^^^^^^^  
(enable\_mask \>\> 12) & 0X3F])  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/usr/lib/python3/dist-packages/smbus2/smbus2.py”, line 643, in write\_i2c\_block\_data  
ioctl(self.fd, I2C\_SMBUS, msg)  
~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^  
OSError: [Errno 5] Input/output error  
Exception ignored in: \<function Trilobot. **del** at 0x7f96256d40\>  
Traceback (most recent call last):  
File “/home/pi/.virtualenvs/pimoroni/lib/python3.13/site-packages/trilobot/ **init**.py”, line 155, in **del**  
self.sn3218.disable()  
AttributeError: ‘Trilobot’ object has no attribute ‘sn3218’  
(pimoroni) pi@pi:~/Pimoroni/trilobot/examples $ Trilobot Example: Movement

Traceback (most recent call last):  
File “/home/pi/Pimoroni/trilobot/examples/movements.py”, line 13, in  
tbot = Trilobot()  
File “/home/pi/.virtualenvs/pimoroni/lib/python3.13/site-packages/trilobot/ **init**.py”, line 134, in **init**  
self.sn3218 = sn3218.SN3218()  
~~~~~~~~~~~~~ ^^  
File “/home/pi/.virtualenvs/pimoroni/lib/python3.13/site-packages/sn3218/ **init**.py”, line 26, in **init**  
self.enable\_leds(enable\_mask)  
~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^  
File “/home/pi/.virtualenvs/pimoroni/lib/python3.13/site-packages/sn3218/ **init**.py”, line 55, in enable\_leds  
self.i2c.write\_i2c\_block\_data(I2C\_ADDRESS, CMD\_ENABLE\_LEDS, [  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
enable\_mask & 0x3F,  
^^^^^^^^^^^^^^^^^^^  
(enable\_mask \>\> 6) & 0x3F,  
^^^^^^^^^^^^^^^^^^^^^^^^^^  
(enable\_mask \>\> 12) & 0X3F])  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/usr/lib/python3/dist-packages/smbus2/smbus2.py”, line 643, in write\_i2c\_block\_data  
ioctl(self.fd, I2C\_SMBUS, msg)  
~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^  
OSError: [Errno 5] Input/output error  
Exception ignored in: \<function Trilobot. **del** at 0x7f96256d40\>  
Traceback (most recent call last):  
File “/home/pi/.virtualenvs/pimoroni/lib/python3.13/site-packages/trilobot/ **init**.py”, line 155, in **del**  
self.sn3218.disable()  
AttributeError: ‘Trilobot’ object has no attribute ‘sn3218’

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [February 14, 2026, 7:24pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/7 "2026-02-14T19:24:28Z")

</div>

Does you Trilobot have an sn3218 18-Channel 8-bit PWM LED Driver?

---

<div class="post-metadata">

**Author:** ![Bryan](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@Bryan](https://forums.pimoroni.com/u/Bryan)\
**Post date:** [February 14, 2026, 8:02pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/8 "2026-02-14T20:02:41Z")

</div>

Yes it has a sn3218 PWM LED Driver IC

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [February 15, 2026, 8:54am UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/9 "2026-02-15T08:54:12Z")

</div>

Ok, might want to post the code your running. Use the preformatted text button \</\> to post it in code tags. That will retain the formatting, indents etc.  
Do the same with the error message, that should make it easy to see what line of code is erroring, and maybe why?

---

<div class="post-metadata">

**Author:** ![Bryan](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@Bryan](https://forums.pimoroni.com/u/Bryan)\
**Post date:** [February 15, 2026, 10:54pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/10 "2026-02-15T22:54:59Z")

</div>

Thanks for the reply. The error “_ **ModuleNotFoundError: No module named ‘trilobot” Appears when trying basically ANY of the example programs supplied for the Trilobot on Githut.** _

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [February 15, 2026, 11:04pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/11 "2026-02-15T23:04:32Z")

</div>

Each time you open a session I would first run  
`source ~/.virtualenvs/pimoroni/bin/activate`  
Just to make sure you running everything in the virtual environment.

If your already doing that, I don’t know what’s going wrong.  
@hel might though?

---

<div class="post-metadata">

**Author:** ![Bryan](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@Bryan](https://forums.pimoroni.com/u/Bryan)\
**Post date:** [February 16, 2026, 3:20am UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/12 "2026-02-16T03:20:36Z")

</div>

Good suggestion. I have been doing that every time I boot up.

---

<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:** [February 16, 2026, 12:52pm UTC](https://forums.pimoroni.com/t/trilobot-module-error/28693/13 "2026-02-16T12:52:36Z")

</div>

Might be worth trying installing the library with the following commands?

```bash
git clone https://github.com/pimoroni/trilobot-python
cd trilobot-python
./install.sh --unstable

```

If you’re not using `--unstable` I think it might try and pull the previous version of the library from pip.
