Problem installing Unicorn Hat

We are completely new to our raspberry Pi and are have a problem getting the Unicorn Hat software to install properly. Below is a copy of the error messages:

pi@raspberrypi:/ $ curl -sS get.pimoroni.com/unicornhat | bash

This script will install everything needed to use your
Unicorn HAT/pHAT

Always be careful when running scripts and commands
copied from the internet. Ensure they are from a
trusted source.

If you want to see what this script does before
running it, you should run:
\curl -sS https://get.pimoroni.com/unicornhat

Do you wish to continue? [y/N] y

Checking environmentā€¦
Updating apt indexesā€¦
ā€¦
Reading package listsā€¦
ā€¦

Checking hardware requirementsā€¦

Checking for packages required for GPIO controlā€¦
Requirement already satisfied (use --upgrade to upgrade): RPi.GPIO in /usr/lib/python2.7/dist-packages
Cleaning upā€¦
Requirement already satisfied (use --upgrade to upgrade): RPi.GPIO in /usr/lib/python3/dist-packages
Cleaning upā€¦
RPi.GPIO installed and up-to-date

Unicorn HAT/pHAT comes with examples and documentation that you may wish to install.
Performing a full install will ensure those resources are installed,
along with all required dependencies. It may however take a while!

Do you wish to perform a full install? [y/N] y
Checking install requirementsā€¦

Checking for dependenciesā€¦

python-dev is required
Installing python-devā€¦
E: Unmet dependencies. Try ā€˜apt-get -f installā€™ with no packages (or specify a solution).
Apt failed to install python-dev!
Falling back on pypiā€¦
python3-dev is already installed

Installing Unicorn HAT/pHAT library for Python 2ā€¦

Requirement already satisfied (use --upgrade to upgrade): unicornhat in /usr/local/lib/python2.7/dist-packages
Downloading/unpacking rpi-ws281x>=2.0.0 (from unicornhat)
Downloading rpi_ws281x-2.0.3.tar.gz (92kB): 92kB downloaded
Running setup.py (path:/tmp/pip-build-mYmmx9/rpi-ws281x/setup.py) egg_info for package rpi-ws281x

Installing collected packages: rpi-ws281x
Running setup.py install for rpi-ws281x
Compiling ws281x libraryā€¦
building ā€˜_rpi_ws281xā€™ extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Ilib/ -I/usr/include/python2.7 -c rpi_ws281x_wrap.c -o build/temp.linux-armv7l-2.7/rpi_ws281x_wrap.o
rpi_ws281x_wrap.c:130:21: fatal error: Python.h: No such file or directory
# include <Python.h>
^
compilation terminated.
error: command ā€˜arm-linux-gnueabihf-gccā€™ failed with exit status 1
Complete output from command /usr/bin/python -c ā€œimport setuptools, tokenize;file=ā€™/tmp/pip-build-mYmmx9/rpi-ws281x/setup.pyā€™;exec(compile(getattr(tokenize, ā€˜openā€™, open)(file).read().replace(ā€™\r\nā€™, ā€˜\nā€™), file, ā€˜execā€™))ā€ install --record /tmp/pip-ObbfI8-record/install-record.txt --single-version-externally-managed --compile:
running install

running build

running build_py

Compiling ws281x libraryā€¦

creating build

creating build/lib.linux-armv7l-2.7

copying neopixel.py -> build/lib.linux-armv7l-2.7

running build_ext

building ā€˜_rpi_ws281xā€™ extension

creating build/temp.linux-armv7l-2.7

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Ilib/ -I/usr/include/python2.7 -c rpi_ws281x_wrap.c -o build/temp.linux-armv7l-2.7/rpi_ws281x_wrap.o

rpi_ws281x_wrap.c:130:21: fatal error: Python.h: No such file or directory

include <Python.h>

                 ^

compilation terminated.

error: command ā€˜arm-linux-gnueabihf-gccā€™ failed with exit status 1


Cleaning upā€¦
Command /usr/bin/python -c ā€œimport setuptools, tokenize;file=ā€™/tmp/pip-build-mYmmx9/rpi-ws281x/setup.pyā€™;exec(compile(getattr(tokenize, ā€˜openā€™, open)(file).read().replace(ā€™\r\nā€™, ā€˜\nā€™), file, ā€˜execā€™))ā€ install --record /tmp/pip-ObbfI8-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-mYmmx9/rpi-ws281x
Storing debug log for failure in /root/.pip/pip.log
Python 2 library install failed!
If problems persist, visit forums.pimoroni.com for support

apt does not sound like it is linked the standard Raspbian repository. Is this on Raspbian? if it is, have you altered your apt sources?

either way, you need python-dev (python3-dev) and the script canā€™t install them for you, because it canā€™t find them in your declared sources.

Sorry, Iā€™m not sure I understand as Iā€™m very new to this. I thought I had python 3 already installed but maybe not. How can I check my raspberry Pi to answer your questions?

Thanks

python-dev is a package that allows compilation of python related software from source code.

anyhow, if you are on Raspbian, try the following:

sudo apt-get update
sudo apt-get -f install
sudo apt-get install python-dev python3-dev

if any of the above returns an error then please post it here.

Thanks for your help with this. Yes, the second command returned an error (see below) - it seems iā€™ve run out of memory. I tried to remove Wolfram but this also caused an error (also coped below).

pi@raspberrypi:~ $ sudo apt-get -f install
Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
Correcting dependenciesā€¦ Done
The following packages were automatically installed and are no longer required:
libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5qml5 libqt5quick5
libqt5widgets5 libxcb-icccm4 libxcb-render-util0 libxcb-xkb1
libxkbcommon-x11-0 qml-module-qtquick-controls qml-module-qtquick-dialogs
qml-module-qtquick-layouts qml-module-qtquick-privatewidgets
qml-module-qtquick-window2 qml-module-qtquick2 qttranslations5-l10n
Use ā€˜apt-get autoremoveā€™ to remove them.
The following extra packages will be installed:
0ad-data
The following NEW packages will be installed:
0ad-data
0 upgraded, 1 newly installed, 0 to remove and 136 not upgraded.
1 not fully installed or removed.
Need to get 0 B/566 MB of archives.
After this operation, 1,456 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ā€¦ 138774 files and directories currently installed.)
Preparing to unpack ā€¦/0ad-data_0.0.17-1_all.deb ā€¦
Unpacking 0ad-data (0.0.17-1) ā€¦
dpkg: error processing archive /var/cache/apt/archives/0ad-data_0.0.17-1_all.deb (ā€“unpack):
cannot copy extracted data for ā€˜./usr/share/games/0ad/mods/public/public.zipā€™ to ā€˜/usr/share/games/0ad/mods/public/public.zip.dpkg-newā€™: failed to write (No space left on device)
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/0ad-data_0.0.17-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

pi@raspberrypi:~ sudo apt-get purge wolfram-engine Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: 0ad : Depends: 0ad-data (>= 0.0.17) but it is not going to be installed Depends: 0ad-data (<= 0.0.17-1) but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). pi@raspberrypi:~ sudo apt-get -f install
Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
Correcting dependenciesā€¦ Done
The following packages were automatically installed and are no longer required:
libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5qml5 libqt5quick5
libqt5widgets5 libxcb-icccm4 libxcb-render-util0 libxcb-xkb1
libxkbcommon-x11-0 qml-module-qtquick-controls qml-module-qtquick-dialogs
qml-module-qtquick-layouts qml-module-qtquick-privatewidgets
qml-module-qtquick-window2 qml-module-qtquick2 qttranslations5-l10n
Use ā€˜apt-get autoremoveā€™ to remove them.
The following extra packages will be installed:
0ad-data
The following NEW packages will be installed:
0ad-data
0 upgraded, 1 newly installed, 0 to remove and 136 not upgraded.
1 not fully installed or removed.
Need to get 0 B/566 MB of archives.
After this operation, 1,456 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

well, the package that created the issue will keep on hosing things unless you specifically tell the system to abandon attempting to install it! Try:

sudo apt-get remove 0ad
sudo apt-get autoremove
sudo apt-get autoclean

ā€¦ hopefully that will do the trick. If not it may be advisable to start fresh on the SD, and keep an eye of on remaining space when adding software to your Pi (particularly those flagged with requiring half a gig or more).

All working fine now. Thanks for your help, much appreciated!

1 Like