Hi The Pi has been sitting in a box for two years but after going to an excellent event at the weekend where we bought a Pibrella, I decided to dust it off. After taking ages to update/upgrade etc, I followed all the instructions that I could find to get the Pibrella working.
I am stuck!
Got to python and typed import Pibrella but nothing is happening and if I try any other commands, they do not work presumably because Pibrella is not imported.
I desperately want to keep my kids interested in this stuff but to be honest I am sick of computing taking so blooming long to get up and going each time I brave it.
Please can someone help?
Taking a blooming long time is an unfortunate hallmark of computing- I think many of us were chipping away at problems until 6am just to learn something trivial like âdonât do that again.â Iâm not exactly selling it, but itâs worth it!
Were you at the York Raspberry Jam, by any chance?
Anyway! Without further ado could you supply us with a screenshot ( or a photo ) of whatever output youâre getting from Python? Thatâd be super helpful, and with any luck itâll be a trivial little problem that weâll get sorted in no time.
Thanks!
Thank you. We were all at the Raspberry Jam event and loved it! :) That is why the Raspi has been dusted off.
AhâŚapparently it is telling me that new users cannot upload photos. :/
Dâoh! Can you email it to me? Phil@pimoroni.com
It was a really great jam and venue, was great to see so many people there and lots of interest in Pibrella!
Will have to look into forum image uploads and see if we can permit them in some cases- theyâll be blocked for spam reasons I imagine, sorry!
Edit: Iâve found out how to change you to a âBasic Userâ, I donât know what thatâs means but it might let you post images!
Great, thanks. I have sent them to your email.
Brilliant. Iâll keep my eye open. The following is a shot in the dark, butâŚ
When you fire up Python do you use IDLE, and do you use IDLE or IDLE3? I think our Pibrella install instructions only deal with Python 2 ( IDLE ) and lots of people now use Python 3 ( IDLE3 ). The install process is, frustratingly, different for each.
You can install for 3 by going into LXTerminal and typing:
sudo apt-get install python3-pip
sudo pip-3.2 install pibrella
(Edited to pip-3.2! Dâoh)
I think the internet ate the pictures- I havenât seen them come through yet, and Iâve even braved my spam inbox!
Itâs probably my new phone! I guess on the upside, as itâs so hopeless, I donât use it so much! :D
Iâve had another go and when going through the instructions that we got the other day, I have noticed that it says to install Scratch GPIO onto my SD card. I just have the Scratch that came on the card when I got to from Maplin. Could this be the issue?
Missing Scratch GPIO wont affect Python, but itâll certainly stop you from talking to the Pibrella in scratch.
Generally the steps for getting up and running with Python should be:
- Start LXTerminal / Command-line
- Type:
Python 2.x
sudo apt-get install python-pip
sudo pip install pibrella
sudo python
>> import pibrella
>> pibrella.light.on()
Python 3.x
sudo apt-get install python3-pip
sudo pip-3.2 install pibrella
sudo python
>> import pibrella
>> pibrella.light.on()
If youâre using IDLE instead of interactive Python on the command-line, the last two lines will be the same.
There are a number of errors you can get; an ImportError meaning the Pibrella library isnât installed, or is not installed correctly, you can try uninstalling and following the steps again by doing:
sudo pip-3.2 uninstall pibrella
sudo pip uninstall pibrella
Or you might successfully import Pibrella but nothing happens on the board when you type commands- this could be a misplaced board thatâs not in the right place on the header ( we managed to do this about 10 times in a Workshop by hurrying through them, with amusing results ).
I think I should get writing an install script for Pibrella and ( possibly ) Scratch GPIO soon!
Tried all of the above. I have managed to install Scratch GPIO too but with no joy.
Whenever I ask it to import pibrella on python (either version) nothing seems to happen.
I shall try turning it off and on again. ;D
Result when I try to install pibrella
Edit: There was meant to be a picture with this !
Dâoh! Can you copy & paste the result and post it from the Pi, perhaps?
pi@raspberrypi ~ $ sudo pip install pibrella
Requirement already satisfied (use --upgrade to upgrade): pibrella in /usr/local/lib/python2.7/dist-packages
Downloading/unpacking rpi.gpio>=0.5.5 (from pibrella)
Running setup.py egg_info for package rpi.gpio
Installing collected packages: rpi.gpio
Running setup.py install for rpi.gpio
building âRPi.GPIOâ extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o
source/py_gpio.c:23:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command âgccâ failed with exit status 1
Complete output from command /usr/bin/python -c âimport setuptools;file=â/home/pi/build/rpi.gpio/setup.pyâ;exec(compile(open(file).read().replace(â\r\nâ, â\nâ), file, âexecâ))â install --single-version-externally-managed --record /tmp/pip-YV5K6a-record/install-record.txt:
running install
running build
running build_py
running build_ext
building âRPi.GPIOâ extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o
source/py_gpio.c:23:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command âgccâ failed with exit status 1
Command /usr/bin/python -c âimport setuptools;file=â/home/pi/build/rpi.gpio/setup.pyâ;exec(compile(open(file).read().replace(â\r\nâ, â\nâ), file, âexecâ))â install --single-version-externally-managed --record /tmp/pip-YV5K6a-record/install-record.txt failed with error code 1 in /home/pi/build/rpi.gpio
Storing complete log in /root/.pip/pip.log
Yup! It really took me 40 minutes to do that! :D
Copy and paste that was! Not even typing it out!
Haha fortunately it really helps! Your problem is this:
âPython.h: No such file or directory
compilation terminated.â
I always forget this one! You need to:
sudo apt-get install python-dev
And then reinstall Pibrella with:
sudo pip install pibrella -I
The capital âiâ on the end tells pip to ignore already installed stuff and go for a full resinstall.
For Python 3 itâs;
sudo apt-get install python3-dev
pip-3.2 install pibrella -I
Good luck!
1 Like
Whoo hoo! It works! :D
Should it now work with Scratch if I use Scratch GPIO? Also will the PiGlow need anything extra to work for when I dare move onto it?
Thanks for your help.
Hurrah!
Iâm honestly not sure about Scratch GPIO, Iâve never actually used or installed it myself! Iâll find out!
As for PiGlow, that should be a little easier because I know all the pitfalls. Following on from my UnicornHat and Dot3k installers, Iâm writing scripts to, hopefully, make both Pibrella and PiGlow easy as pie to install.
If you feel like being a crash-test-dummy for an afternoon, you can try:
curl -sS get.pimoroni.com/pibrella | bash
This will also give you the option to install Scratch GPIO 5, which Iâve tested! You should see Scratch GPIO 5 and Scratch GPIO 5 Plus on the desktop, I believe you can use Pibrella from either of these.
Thereâs a guide to Pibrella in Scratch here, too: http://camjam.me/camjam/wp-content/uploads/2014/02/Pibrella.pdf
Fabulous. I have done that and it is working in Scratch too. :) Thank you.