Problem installing Unicorn Hat


#1

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


#2

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.


#3

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


#4

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.


#5

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.


#6

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).


#7

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