How to setup Raspbian Stretch Lite on Raspberry Pi Zero W to run Python 3 applications
With Wi-Fi included, the Raspberry Pi Zero W is very useful for implementing embedded projects that require Internet connection.
Apart from using the Raspberry Pi Zero W for CCTV surveillance, we can run customized Python 3 applications on a Raspberry Pi Zero W for various use cases.
Pairing the official operating system for Raspberry Pi with Python 3, we will be able to get a versatile computer to do our bidding.
Anticipating the need to setup a version of Raspbian Lite on Raspberry Pi Zero W for future Python 3 projects, I created this post to document the steps of how to do so with Raspbian Stretch Lite.
Recommended hardware list
- Raspberry Pi Zero W (Wireless) & Official Case
- Kingston Digital 32GB microSDHC Class 10 UHS-I 45R Flash Card (SDC10G2/32GBSP)
- Belkin micro USB cable
- Unused USB charger
Required hardware to install Raspbian Stretch Lite onto the microSD
Raspberry Pi Zero W board will load Raspbian Stretch Lite from a microSD card. Hence, we will need to have a computer with a SD card reader. If your computer does not come with a SD card reader, you have to get one.
If you have the standard SD card reader on your computer but do not have a SD card adapter, you may want to get the Kingston Digital 32 GB microSDHC Class 10 UHS-1 Memory Card 30MB/s with Adapter (SDC10/32GB) instead.
Downloading Raspbian Stretch Lite for Raspberry Pi Zero W
Once I had the necessary hardware list for my embedded project, I proceeded to download a copy of Raspbian Stretch Lite. As of this writing, the one that was available was dated 7th September 2017:
I clicked on the Download Zip button for Raspbian Stretch Lite and saved the zip file onto my file system.
Installing Raspbian Stretch Lite onto the microSD card
Once my browser had completed the download for the .zip
file, I extracted the .img
file from the .zip
file. The .img
file was the operating system image that I used for installing Raspbian Stretch Lite onto my microSD card.
I used Etcher on my MacBook Pro to install the operating system image onto the microSD card.
If you are using a windows machine, you can use Win32DiskImager to install the operating system for your Raspberry Pi Zero W.
If you are using a Linux desktop, you should be able to Etcher to install the operating system for your Raspberry Pi Zero W.
Enabling SSH server on Raspbian Stretch Lite first boot
With an SSH server running on Raspbian Stretch Lite, I do not have to find a spare keyboard, spare monitor, a mini HDMI to HDMI adapter and a OTG cable in order to configure Raspbian Stretch Lite after it had booted up for the first time.
To ensure that I had the SSH server running after the first boot, I created an empty file named "ssh” in the boot partition of the microSD card:
Getting Raspberry Pi Zero W connect to your 2.4 GHz Wi-Fi network on first boot
The SSH server is the first piece to allow remote configuration of the Raspbian Stretch Lite operating system running the Raspberry Pi Zero W. The next piece is to setup the physical network connection to my home network.
The Wi-Fi chip on Raspberry Pi Zero W connects to a 2.4 GHz Wi-Fi network. To get my Raspberry Pi Zero W to connect to my 2.4 GHz Wi-Fi network, I first created a text file with the following contents:
country=SG ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ scan_ssid=1 ssid="the_2.4-hz-wireless-network" psk="the_2.4-hz-wireless-network_password" proto=WPA key_mgmt=WPA-PSK }
and placed it into the boot partition of the microSD card:
Be sure to replace the country, ssid and psk values to the appropriate values for your 2.4GHz Wi-Fi network.
After I got the wpa_supplicant.conf
file into the boot partition of the microSD card, I removed it from my computer and inserted it into the microSD card slot on my Raspberry Pi Zero W board.
Booting up Raspbian Stretch Lite
After assembling the Raspberry Pi Zero W board to the Raspberry Pi Zero official case, I then proceeded to connect my Belkin micro USB cable to my USB charger and the power port on my Raspberry Pi Zero W board. After switching on the wall socket which my USB charger was plugged into, the Raspberry Pi Zero W board booted up the Raspbian Stretch Lite operating system.
Getting the IP address of my Raspberry Pi Zero W
When Raspbian Stretch Lite booted up, it requested an IP address from my router. This IP address was needed for me to SSH into my Raspberry Pi Zero W. To get the IP Address that my router had allocated to my Raspbian Stretch Lite, I went to my router's address allocation table and find an entry with the name raspberrypi. In my case, the router allocated 192.168.1.106 to my Raspbian Stretch Lite.
Getting into the Raspbian Stretch Lite operating system via SSH from my computer
The default credentials to log into Raspberry Pi Stretch Lite is as follows:
Username: pi
Password: raspberry
With the default credentials and the IP address that my router had given to my Raspbian Stretch Lite, I then used SSH to get into the operating system:
ssh pi@192.168.1.106
I entered raspberry when the Raspbian Stretch Lite prompted for password. With that, my Raspbian Stretch Lite greeted me with the following output:
Linux raspberrypi 4.9.41+ #1023 Tue Aug 8 15:47:12 BST 2017 armv6l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
Changing the default password of the pi user
Since Raspbian Stretch Lite suggested that using the default password for the 'pi' user is a security risk, the next thing that I did was to change the default password. To do so, I entered the following command:
passwd
For the three prompts that followed the command, I entered raspberry and my favourite password twice.
Configuring the locale settings on Raspbian Stretch Lite
The next thing that I did was to configure the locale settings for my Raspbian Stretch Lite. To do so, I first opened up the Raspberry Pi Software Configuration Tool:
sudo raspi-config
I then followed through the following screens to generate the "en_US.UTF-8" locale and set it as the default locale for the system environment:
After doing so, I opened up /etc/default/locale with nano:
sudo nano /etc/default/locale
And updated the contents to look like the following:
LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANGUAGE=en_US.UTF-8
This would ensure that the locale settings for my Raspbian Stretch Lite persist through system reboots.
Changing Timezone
The default timezone of Raspbian Stretch Lite is "Etc/UTC". However, since my Raspberry Pi Zero W will be residing in Singapore, I wanted it to follow Singapore's Timezone.
To change the timezone on my Raspbian Stretch Lite, I used the Raspberry Pi Software Configuration Tool mentioned earlier and went through the following steps:
Listing the default packages that came along with my Raspbian Stretch Lite installation
The next thing that I did was to check the list of packages that came along with the Raspbian Stretch Lite installation. To do so, I typed the following command:
apt list --installed
Which gave me the following list:
adduser/stable,now 3.115 all [installed] alsa-utils/stable,now 1.1.3-1 armhf [installed,automatic] apt/stable,now 1.4.7 armhf [installed] apt-listchanges/stable,now 3.10 all [installed] apt-transport-https/stable,now 1.4.7 armhf [installed] apt-utils/stable,now 1.4.7 armhf [installed] aptitude/stable,now 0.8.7-1 armhf [installed] aptitude-common/stable,now 0.8.7-1 all [installed] avahi-daemon/stable,now 0.6.32-2 armhf [installed] base-files/stable,now 9.9+rpi1+deb9u1 armhf [installed] base-passwd/stable,now 3.5.43 armhf [installed] bash/stable,now 4.4-5 armhf [installed] bash-completion/stable,now 1:2.1-4.3 all [installed] bind9-host/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed,automatic] binutils/stable,now 2.28-5 armhf [installed,automatic] blends-tasks/stable,now 0.6.96 all [installed] bluez/testing,now 5.43-2+rpi1 armhf [installed,automatic] bluez-firmware/testing,now 1.2-3+rpi2 all [installed,automatic] bsdmainutils/stable,now 9.0.12+nmu1 armhf [installed] bsdutils/stable,now 1:2.29.2-1 armhf [installed] build-essential/stable,now 12.3 armhf [installed] bzip2/stable,now 1.0.6-8.1 armhf [installed,automatic] ca-certificates/stable,now 20161130+nmu1 all [installed] cifs-utils/stable,now 2:6.7-1 armhf [installed] console-setup/stable,now 1.164 all [installed] console-setup-linux/stable,now 1.164 all [installed,automatic] coreutils/stable,now 8.26-3 armhf [installed] cpio/stable,now 2.11+dfsg-6 armhf [installed] cpp/stable,now 4:6.3.0-4 armhf [installed,automatic] cpp-6/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] crda/stable,now 3.18-1 armhf [installed] cron/stable,now 3.0pl1-128 armhf [installed] curl/stable,now 7.52.1-5 armhf [installed] dash/stable,now 0.5.8-2.4 armhf [installed] dbus/stable,now 1.10.18-1 armhf [installed,automatic] dc/stable,now 1.06.95-9 armhf [installed,automatic] debconf/stable,now 1.5.61 all [installed] debconf-i18n/stable,now 1.5.61 all [installed] debconf-utils/stable,now 1.5.61 all [installed] debianutils/stable,now 4.8.1.1 armhf [installed] device-tree-compiler/testing,now 1.4.4-1 armhf [installed,automatic] dh-python/stable,now 2.20170125 all [installed,automatic] dhcpcd5/testing,now 1:6.10.1-1+rpi3 armhf [installed] diffutils/stable,now 1:3.5-3 armhf [installed] distro-info-data/stable,now 0.36 all [installed,automatic] dmidecode/stable,now 3.0-4 armhf [installed] dmsetup/stable,now 2:1.02.137-2 armhf [installed] dosfstools/stable,now 4.1-1 armhf [installed] dphys-swapfile/stable,now 20100506-3 all [installed] dpkg/stable,now 1.18.24 armhf [installed] dpkg-dev/stable,now 1.18.24 all [installed,automatic] e2fslibs/stable,now 1.43.4-2 armhf [installed] e2fsprogs/stable,now 1.43.4-2 armhf [installed] ed/stable,now 1.10-2.1 armhf [installed] fake-hwclock/stable,now 0.11 all [installed] fakeroot/stable,now 1.21-3.1 armhf [installed,automatic] fbset/stable,now 2.1-29 armhf [installed] file/stable,now 1:5.30-1+deb9u1 armhf [installed,automatic] findutils/stable,now 4.6.0+git+20161106-2 armhf [installed] firmware-atheros/testing,now 1:20161130-3+rpi2 all [installed] firmware-brcm80211/testing,now 1:20161130-3+rpi2 all [installed] firmware-libertas/testing,now 1:20161130-3+rpi2 all [installed] firmware-misc-nonfree/testing,now 1:20161130-3+rpi2 all [installed] firmware-realtek/testing,now 1:20161130-3+rpi2 all [installed] g++/stable,now 4:6.3.0-4 armhf [installed,automatic] g++-6/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] gcc/stable,now 4:6.3.0-4 armhf [installed,automatic] gcc-4.6-base/stable,now 4.6.4-5+rpi1 armhf [installed] gcc-4.7-base/stable,now 4.7.3-11+rpi1 armhf [installed] gcc-4.8-base/stable,now 4.8.5-4 armhf [installed] gcc-4.9-base/stable,now 4.9.3-14 armhf [installed] gcc-5-base/stable,now 5.4.1-4 armhf [installed] gcc-6/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] gcc-6-base/stable,now 6.3.0-18+rpi1 armhf [installed] gdb/stable,now 7.12-6 armhf [installed] geoip-database/stable,now 20170512-1 all [installed,automatic] gettext-base/stable,now 0.19.8.1-2 armhf [installed,automatic] gnupg/stable,now 2.1.18-6 armhf [installed] gnupg-agent/stable,now 2.1.18-6 armhf [installed] gpgv/stable,now 2.1.18-6 armhf [installed] grep/stable,now 2.27-2 armhf [installed] groff-base/stable,now 1.22.3-9 armhf [installed] gzip/stable,now 1.6-5 armhf [installed] hardlink/stable,now 0.3.0 armhf [installed] hostname/stable,now 3.18 armhf [installed] htop/stable,now 2.0.2-1 armhf [installed] ifupdown/stable,now 0.8.19 armhf [installed] info/stable,now 6.3.0.dfsg.1-1+b1 armhf [installed] init/stable,now 1.48 armhf [installed] init-system-helpers/stable,now 1.48 all [installed] initramfs-tools/stable,now 0.130 all [installed] initramfs-tools-core/stable,now 0.130 all [installed] install-info/stable,now 6.3.0.dfsg.1-1+b1 armhf [installed] iproute2/stable,now 4.9.0-1 armhf [installed] iptables/stable,now 1.6.0+snapshot20161117-6 armhf [installed] iputils-ping/stable,now 3:20161105-1 armhf [installed] isc-dhcp-client/stable,now 4.3.5-3 armhf [installed] isc-dhcp-common/stable,now 4.3.5-3 armhf [installed] iso-codes/stable,now 3.75-1 all [installed,automatic] iw/stable,now 4.9-0.1 armhf [installed,automatic] kbd/stable,now 2.0.3-2 armhf [installed,automatic] keyboard-configuration/stable,now 1.164 all [installed] keyutils/stable,now 1.5.9-9 armhf [installed,automatic] klibc-utils/stable,now 2.0.4-9+rpi1 armhf [installed] kmod/stable,now 23-2 armhf [installed] less/stable,now 481-2.1 armhf [installed] libacl1/stable,now 2.2.52-3 armhf [installed] libalgorithm-diff-perl/stable,now 1.19.03-1 all [installed,automatic] libalgorithm-diff-xs-perl/stable,now 0.04-4+b2 armhf [installed,automatic] libalgorithm-merge-perl/stable,now 0.08-3 all [installed,automatic] libapparmor1/stable,now 2.11.0-3 armhf [installed] libapt-inst2.0/stable,now 1.4.7 armhf [installed] libapt-pkg5.0/stable,now 1.4.7 armhf [installed] libasan3/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] libasound2/testing,now 1.1.3-5+rpi3 armhf [installed,automatic] libasound2-data/testing,now 1.1.3-5+rpi3 all [installed,automatic] libassuan0/stable,now 2.4.3-2 armhf [installed] libatomic1/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] libattr1/stable,now 1:2.4.47-2 armhf [installed] libaudit-common/stable,now 1:2.6.7-2 all [installed] libaudit1/stable,now 1:2.6.7-2 armhf [installed] libavahi-common-data/stable,now 0.6.32-2 armhf [installed,automatic] libavahi-common3/stable,now 0.6.32-2 armhf [installed,automatic] libavahi-core7/stable,now 0.6.32-2 armhf [installed,automatic] libbabeltrace-ctf1/stable,now 1.5.1-1 armhf [installed,automatic] libbabeltrace1/stable,now 1.5.1-1 armhf [installed,automatic] libbind9-140/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed,automatic] libblkid1/stable,now 2.29.2-1 armhf [installed] libboost-filesystem1.62.0/stable,now 1.62.0+dfsg-4 armhf [installed] libboost-iostreams1.58.0/stable,now 1.58.0+dfsg-5.1+rpi1+b1 armhf [installed] libboost-iostreams1.60.0/stable,now 1.60.0+dfsg-6+b2 armhf [installed] libboost-iostreams1.62.0/stable,now 1.62.0+dfsg-4 armhf [installed] libboost-system1.62.0/stable,now 1.62.0+dfsg-4 armhf [installed] libbsd0/stable,now 0.8.3-1 armhf [installed] libbz2-1.0/stable,now 1.0.6-8.1 armhf [installed] libc-bin/stable,now 2.24-11+deb9u1 armhf [installed] libc-dev-bin/stable,now 2.24-11+deb9u1 armhf [installed,automatic] libc-l10n/stable,now 2.24-11+deb9u1 all [installed,automatic] libc6/stable,now 2.24-11+deb9u1 armhf [installed] libc6-dbg/stable,now 2.24-11+deb9u1 armhf [installed,automatic] libc6-dev/stable,now 2.24-11+deb9u1 armhf [installed,automatic] libcap-ng0/stable,now 0.7.7-3 armhf [installed] libcap2/stable,now 1:2.25-1 armhf [installed] libcap2-bin/stable,now 1:2.25-1 armhf [installed] libcc1-0/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] libcomerr2/stable,now 1.43.4-2 armhf [installed] libcryptsetup4/stable,now 2:1.7.3-4 armhf [installed] libcurl3/stable,now 7.52.1-5 armhf [installed,automatic] libcurl3-gnutls/stable,now 7.52.1-5 armhf [installed,automatic] libcwidget3v5/stable,now 0.5.17-4 armhf [installed] libdaemon0/stable,now 0.14-6 armhf [installed,automatic] libdb5.3/stable,now 5.3.28-12 armhf [installed] libdbus-1-3/stable,now 1.10.18-1 armhf [installed] libdebconfclient0/stable,now 0.227 armhf [installed] libdevmapper1.02.1/stable,now 2:1.02.137-2 armhf [installed] libdns-export162/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed] libdns162/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed,automatic] libdpkg-perl/stable,now 1.18.24 all [installed,automatic] libdrm2/stable,now 2.4.74-1 armhf [installed] libdw1/stable,now 0.168-1 armhf [installed,automatic] libedit2/stable,now 3.1-20160903-3 armhf [installed,automatic] libelf1/stable,now 0.168-1 armhf [installed] libestr0/stable,now 0.1.10-2 armhf [installed] libevent-2.0-5/stable,now 2.0.21-stable-3 armhf [installed,automatic] libexpat1/stable,now 2.2.0-2+deb9u1 armhf [installed,automatic] libfakeroot/stable,now 1.21-3.1 armhf [installed,automatic] libfastjson4/stable,now 0.99.4-1 armhf [installed] libfdisk1/stable,now 2.29.2-1 armhf [installed] libffi6/stable,now 3.2.1-6 armhf [installed] libfftw3-single3/stable,now 3.3.5-3 armhf [installed,automatic] libfile-fcntllock-perl/stable,now 0.22-3+b2 armhf [installed,automatic] libfreetype6/stable,now 2.6.3-3.2 armhf [installed,automatic] libfreetype6-dev/stable,now 2.6.3-3.2 armhf [installed] libgcc-6-dev/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] libgcc1/stable,now 1:6.3.0-18+rpi1 armhf [installed] libgcrypt20/stable,now 1.7.6-2+deb9u2 armhf [installed] libgdbm3/stable,now 1.8.3-14 armhf [installed] libgeoip1/stable,now 1.6.9-4 armhf [installed,automatic] libglib2.0-0/stable,now 2.50.3-2 armhf [installed,automatic] libglib2.0-data/stable,now 2.50.3-2 all [installed,automatic] libgmp10/stable,now 2:6.1.2+dfsg-1 armhf [installed] libgnutls30/stable,now 3.5.8-5+deb9u2 armhf [installed] libgomp1/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] libgpg-error0/stable,now 1.26-2 armhf [installed] libgssapi-krb5-2/stable,now 1.15-1 armhf [installed,automatic] libhogweed4/stable,now 3.3-1 armhf [installed] libicu57/stable,now 57.1-6 armhf [installed,automatic] libident/stable,now 0.22-3.1 armhf [installed] libidn11/stable,now 1.33-1 armhf [installed] libidn2-0/stable,now 0.16-1 armhf [installed] libip4tc0/stable,now 1.6.0+snapshot20161117-6 armhf [installed] libip6tc0/stable,now 1.6.0+snapshot20161117-6 armhf [installed] libiptc0/stable,now 1.6.0+snapshot20161117-6 armhf [installed] libisc-export160/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed] libisc160/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed,automatic] libisccc140/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed,automatic] libisccfg140/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed,automatic] libisl15/stable,now 0.18-1 armhf [installed,automatic] libiw30/stable,now 30~pre9-12 armhf [installed,automatic] libjim0.76/stable,now 0.76-2 armhf [installed,automatic] libjpeg62-turbo/stable,now 1:1.5.1-2 armhf [installed,automatic] libk5crypto3/stable,now 1.15-1 armhf [installed,automatic] libkeyutils1/stable,now 1.5.9-9 armhf [installed,automatic] libklibc/stable,now 2.0.4-9+rpi1 armhf [installed] libkmod2/stable,now 23-2 armhf [installed] libkrb5-3/stable,now 1.15-1 armhf [installed,automatic] libkrb5support0/stable,now 1.15-1 armhf [installed,automatic] libksba8/stable,now 1.3.5-2 armhf [installed] libldap-2.4-2/stable,now 2.4.44+dfsg-5 armhf [installed,automatic] libldap-common/stable,now 2.4.44+dfsg-5 all [installed,automatic] liblocale-gettext-perl/stable,now 1.07-3+b1 armhf [installed] liblogging-stdlog0/stable,now 1.0.5-2 armhf [installed] liblognorm5/stable,now 2.0.1-1.1 armhf [installed] libluajit-5.1-common/stable,now 2.0.4+dfsg-1 all [installed,automatic] liblwres141/stable,now 1:9.10.3.dfsg.P4-12.3+deb9u2 armhf [installed,automatic] liblz4-1/stable,now 0.0~r131-2 armhf [installed] liblzma5/stable,now 5.2.2-1.2 armhf [installed] libmagic-mgc/stable,now 1:5.30-1+deb9u1 armhf [installed,automatic] libmagic1/stable,now 1:5.30-1+deb9u1 armhf [installed,automatic] libmnl-dev/stable,now 1.0.4-2 armhf [installed] libmnl0/stable,now 1.0.4-2 armhf [installed] libmount1/stable,now 2.29.2-1 armhf [installed] libmpc3/stable,now 1.0.3-1 armhf [installed,automatic] libmpdec2/stable,now 2.4.2-1 armhf [installed,automatic] libmpfr4/stable,now 3.1.5-1 armhf [installed,automatic] libmtp-common/stable,now 1.1.13-1 all [installed,automatic] libmtp-runtime/stable,now 1.1.13-1 armhf [installed] libmtp9/stable,now 1.1.13-1 armhf [installed,automatic] libncurses5/stable,now 6.0+20161126-1 armhf [installed] libncursesw5/stable,now 6.0+20161126-1 armhf [installed] libnetfilter-conntrack3/stable,now 1.0.6-2 armhf [installed] libnettle6/stable,now 3.3-1 armhf [installed] libnewt0.52/stable,now 0.52.19-1 armhf [installed] libnfnetlink0/stable,now 1.0.1-3 armhf [installed] libnfsidmap2/stable,now 0.25-5.1 armhf [installed,automatic] libnghttp2-14/stable,now 1.18.1-1 armhf [installed,automatic] libnih-dbus1/stable,now 1.0.3-8 armhf [installed] libnih1/stable,now 1.0.3-8 armhf [installed] libnl-3-200/stable,now 3.2.27-2 armhf [installed,automatic] libnl-genl-3-200/stable,now 3.2.27-2 armhf [installed,automatic] libnpth0/stable,now 1.3-1 armhf [installed] libnss-mdns/stable,now 0.10-8 armhf [installed,automatic] libp11-kit0/stable,now 0.23.3-2 armhf [installed] libpam-chksshpwd/testing,now 1.1.8-3.6+rpi1 armhf [installed] libpam-modules/testing,now 1.1.8-3.6+rpi1 armhf [installed] libpam-modules-bin/testing,now 1.1.8-3.6+rpi1 armhf [installed] libpam-runtime/testing,now 1.1.8-3.6+rpi1 all [installed] libpam-systemd/stable,now 232-25+deb9u1 armhf [installed,automatic] libpam0g/testing,now 1.1.8-3.6+rpi1 armhf [installed] libparted2/stable,now 3.2-17 armhf [installed,automatic] libpcre3/stable,now 2:8.39-3 armhf [installed] libpcsclite1/stable,now 1.8.20-1 armhf [installed,automatic] libperl5.24/stable,now 5.24.1-3+deb9u1 armhf [installed,automatic] libpipeline1/stable,now 1.4.1-2 armhf [installed] libplymouth4/testing,now 0.9.2-4+rpi1 armhf [installed] libpng-dev/stable,now 1.6.28-1 armhf [installed,automatic] libpng-tools/stable,now 1.6.28-1 armhf [installed,automatic] libpng16-16/stable,now 1.6.28-1 armhf [installed] libpopt0/stable,now 1.16-10 armhf [installed] libprocps6/stable,now 2:3.3.12-3 armhf [installed] libpsl5/stable,now 0.17.0-3 armhf [installed] libpython-stdlib/stable,now 2.7.13-2 armhf [installed,automatic] libpython2.7-minimal/stable,now 2.7.13-2 armhf [installed,automatic] libpython2.7-stdlib/stable,now 2.7.13-2 armhf [installed,automatic] libpython3-stdlib/stable,now 3.5.3-1 armhf [installed,automatic] libpython3.5/stable,now 3.5.3-1 armhf [installed,automatic] libpython3.5-minimal/stable,now 3.5.3-1 armhf [installed,automatic] libpython3.5-stdlib/stable,now 3.5.3-1 armhf [installed,automatic] libraspberrypi-bin/testing,now 1.20170811-1 armhf [installed] libraspberrypi-dev/testing,now 1.20170811-1 armhf [installed] libraspberrypi-doc/testing,now 1.20170811-1 armhf [installed] libraspberrypi0/testing,now 1.20170811-1 armhf [installed] libreadline6/stable,now 6.3-9 armhf [installed] libreadline7/stable,now 7.0-3 armhf [installed] librtmp1/stable,now 2.4+20151223.gitfa8646d.1-1 armhf [installed,automatic] libsamplerate0/stable,now 0.1.8-8 armhf [installed,automatic] libsasl2-2/stable,now 2.1.27~101-g0780600+dfsg-3 armhf [installed,automatic] libsasl2-modules/stable,now 2.1.27~101-g0780600+dfsg-3 armhf [installed,automatic] libsasl2-modules-db/stable,now 2.1.27~101-g0780600+dfsg-3 armhf [installed,automatic] libseccomp2/stable,now 2.3.1-2.1 armhf [installed] libselinux1/stable,now 2.6-3 armhf [installed] libsemanage-common/stable,now 2.6-2 all [installed] libsemanage1/stable,now 2.6-2 armhf [installed] libsepol1/stable,now 2.6-2 armhf [installed] libsigc++-1.2-5c2/stable,now 1.2.7-2+b1 armhf [installed] libsigc++-2.0-0v5/stable,now 2.10.0-1 armhf [installed] libslang2/stable,now 2.3.1-5 armhf [installed] libsmartcols1/stable,now 2.29.2-1 armhf [installed] libsqlite3-0/stable,now 3.16.2-5 armhf [installed] libss2/stable,now 1.43.4-2 armhf [installed] libssh2-1/stable,now 1.7.0-1 armhf [installed,automatic] libssl1.0.2/stable,now 1.0.2l-2 armhf [installed] libssl1.1/stable,now 1.1.0f-3 armhf [installed] libstdc++-6-dev/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] libstdc++6/stable,now 6.3.0-18+rpi1 armhf [installed] libsysfs2/stable,now 2.1.0+repack-4 armhf [installed] libsystemd0/stable,now 232-25+deb9u1 armhf [installed] libtalloc2/stable,now 2.1.8-1 armhf [installed,automatic] libtasn1-6/stable,now 4.10-1.1 armhf [installed] libtext-charwidth-perl/stable,now 0.04-7+b7 armhf [installed] libtext-iconv-perl/stable,now 1.7-5+b8 armhf [installed] libtext-wrapi18n-perl/stable,now 0.06-7.1 all [installed] libtinfo5/stable,now 6.0+20161126-1 armhf [installed] libtirpc1/stable,now 0.2.5-1.2 armhf [installed,automatic] libubsan0/stable,now 6.3.0-18+rpi1 armhf [installed,automatic] libudev0/stable,now 175-7.2 armhf [installed] libudev1/stable,now 232-25+deb9u1 armhf [installed] libunistring0/stable,now 0.9.6+really0.9.3-0.1 armhf [installed] libusb-0.1-4/stable,now 2:0.1.12-30 armhf [installed] libusb-1.0-0/stable,now 2:1.0.21-1 armhf [installed,automatic] libustr-1.0-1/stable,now 1.0.4-6 armhf [installed] libuuid1/stable,now 2.29.2-1 armhf [installed] libv4l-0/stable,now 1.12.3-1 armhf [installed,automatic] libv4l2rds0/stable,now 1.12.3-1 armhf [installed,automatic] libv4lconvert0/stable,now 1.12.3-1 armhf [installed,automatic] libwbclient0/stable,now 2:4.5.8+dfsg-2+deb9u1 armhf [installed,automatic] libwrap0/stable,now 7.6.q-26 armhf [installed,automatic] libx11-6/stable,now 2:1.6.4-3 armhf [installed,automatic] libx11-data/stable,now 2:1.6.4-3 all [installed,automatic] libxapian30/stable,now 1.4.3-2 armhf [installed] libxau6/stable,now 1:1.0.8-1 armhf [installed,automatic] libxcb1/stable,now 1.12-1 armhf [installed,automatic] libxdmcp6/stable,now 1:1.1.2-3 armhf [installed,automatic] libxext6/stable,now 2:1.3.3-1 armhf [installed,automatic] libxml2/stable,now 2.9.4+dfsg1-2.2+deb9u1 armhf [installed,automatic] libxmuu1/stable,now 2:1.1.2-2 armhf [installed,automatic] libxtables12/stable,now 1.6.0+snapshot20161117-6 armhf [installed] linux-base/stable,now 4.5 all [installed] linux-libc-dev/stable,now 3.18.5-1~exp1+rpi19+stretch armhf [installed,automatic] locales/stable,now 2.24-11+deb9u1 all [installed] login/stable,now 1:4.4-4.1 armhf [installed] logrotate/stable,now 3.11.0-0.1 armhf [installed] lsb-base/stable,now 9.20161125+rpi1 all [installed] lsb-release/stable,now 9.20161125+rpi1 all [installed,automatic] lua5.1/stable,now 5.1.5-8.1 armhf [installed] luajit/stable,now 2.0.4+dfsg-1 armhf [installed] make/stable,now 4.1-9.1 armhf [installed,automatic] makedev/stable,now 2.3.1-93 all [installed] man-db/stable,now 2.7.6.1-2 armhf [installed] manpages/stable,now 4.10-2 all [installed,automatic] manpages-dev/stable,now 4.10-2 all [installed] mawk/stable,now 1.3.3-17 armhf [installed] mime-support/stable,now 3.60 all [installed,automatic] mount/stable,now 2.29.2-1 armhf [installed] mountall/stable,now 2.54 armhf [installed] multiarch-support/stable,now 2.24-11+deb9u1 armhf [installed] nano/stable,now 2.7.4-1 armhf [installed] ncdu/stable,now 1.12-1 armhf [installed] ncurses-base/stable,now 6.0+20161126-1 all [installed] ncurses-bin/stable,now 6.0+20161126-1 armhf [installed] ncurses-term/stable,now 6.0+20161126-1 all [installed,automatic] net-tools/stable,now 1.60+git20161116.90da8a0-1 armhf [installed] netbase/stable,now 5.4 all [installed] netcat-openbsd/stable,now 1.130-3 armhf [installed] netcat-traditional/stable,now 1.10-41 armhf [installed] nfs-common/stable,now 1:1.3.4-2.1 armhf [installed] openresolv/stable,now 3.8.0-1 armhf [installed,automatic] openssh-client/stable,now 1:7.4p1-10+deb9u1 armhf [installed,automatic] openssh-server/stable,now 1:7.4p1-10+deb9u1 armhf [installed,automatic] openssh-sftp-server/stable,now 1:7.4p1-10+deb9u1 armhf [installed,automatic] openssl/stable,now 1.1.0f-3 armhf [installed,automatic] parted/stable,now 3.2-17 armhf [installed] passwd/stable,now 1:4.4-4.1 armhf [installed] patch/stable,now 2.7.5-1 armhf [installed,automatic] paxctld/stable,now 1.2.1-1 armhf [installed] perl/stable,now 5.24.1-3+deb9u1 armhf [installed,automatic] perl-base/stable,now 5.24.1-3+deb9u1 armhf [installed] perl-modules-5.24/stable,now 5.24.1-3+deb9u1 all [installed,automatic] pi-bluetooth/testing,now 0.1.6 armhf [installed] pinentry-curses/stable,now 1.0.0-2 armhf [installed] pkg-config/stable,now 0.29-4 armhf [installed] plymouth/testing,now 0.9.2-4+rpi1 armhf [installed] procps/stable,now 2:3.3.12-3 armhf [installed] psmisc/stable,now 22.21-2.1 armhf [installed] python/stable,now 2.7.13-2 armhf [installed] python-apt-common/stable,now 1.1.0~beta5 all [installed,automatic] python-minimal/stable,now 2.7.13-2 armhf [installed,automatic] python-rpi.gpio/testing,now 0.6.3~stretch-1 armhf [installed] python2.7/stable,now 2.7.13-2 armhf [installed,automatic] python2.7-minimal/stable,now 2.7.13-2 armhf [installed,automatic] python3/stable,now 3.5.3-1 armhf [installed,automatic] python3-apt/stable,now 1.1.0~beta5 armhf [installed,automatic] python3-minimal/stable,now 3.5.3-1 armhf [installed,automatic] python3.5/stable,now 3.5.3-1 armhf [installed,automatic] python3.5-minimal/stable,now 3.5.3-1 armhf [installed,automatic] raspberrypi-bootloader/testing,now 1.20170811-1 armhf [installed] raspberrypi-kernel/testing,now 1.20170811-1 armhf [installed,automatic] raspberrypi-net-mods/testing,now 1.2.7 all [installed] raspberrypi-sys-mods/testing,now 20170717 armhf [installed] raspbian-archive-keyring/stable,now 20120528.2 all [installed] raspi-config/testing,now 20170811 all [installed] raspi-copies-and-fills/testing,now 0.5-1 armhf [installed] readline-common/stable,now 7.0-3 all [installed] rename/stable,now 0.20-4 all [installed,automatic] rpcbind/stable,now 0.2.3-0.6 armhf [installed,automatic] rpi-update/testing,now 20140705 all [installed] rsync/stable,now 3.1.2-1 armhf [installed] rsyslog/stable,now 8.24.0-1 armhf [installed] samba-common/stable,now 2:4.5.8+dfsg-2+deb9u1 all [installed,automatic] sed/stable,now 4.4-1 armhf [installed] sensible-utils/stable,now 0.0.9 all [installed] sgml-base/stable,now 1.29 all [installed,automatic] shared-mime-info/stable,now 1.8-1 armhf [installed,automatic] ssh/stable,now 1:7.4p1-10+deb9u1 all [installed] strace/stable,now 4.15-2 armhf [installed] sudo/stable,now 1.8.19p1-2.1 armhf [installed] systemd/stable,now 232-25+deb9u1 armhf [installed] systemd-sysv/stable,now 232-25+deb9u1 armhf [installed] sysvinit-utils/stable,now 2.88dsf-59.9 armhf [installed] tar/stable,now 1.29b-1.1 armhf [installed] tasksel/stable,now 3.39 all [installed] tasksel-data/stable,now 3.39 all [installed] tcpd/stable,now 7.6.q-26 armhf [installed,automatic] traceroute/stable,now 1:2.1.0-2 armhf [installed] triggerhappy/stable,now 0.5.0-1 armhf [installed,automatic] tzdata/stable,now 2017b-1 all [installed] ucf/stable,now 3.0036 all [installed,automatic] udev/stable,now 232-25+deb9u1 armhf [installed] unzip/stable,now 6.0-21 armhf [installed] usb-modeswitch/stable,now 2.5.0+repack0-1 armhf [installed] usb-modeswitch-data/stable,now 20170120-1 all [installed,automatic] usbutils/stable,now 1:007-4 armhf [installed] util-linux/stable,now 2.29.2-1 armhf [installed] v4l-utils/stable,now 1.12.3-1 armhf [installed] vim-common/stable,now 2:8.0.0197-4 all [installed] vim-tiny/stable,now 2:8.0.0197-4 armhf [installed] wget/stable,now 1.18-5 armhf [installed] whiptail/stable,now 0.52.19-1 armhf [installed] wireless-regdb/stable,now 2016.06.10-1 all [installed,automatic] wireless-tools/stable,now 30~pre9-12 armhf [installed] wpasupplicant/stable,now 2:2.4-1 armhf [installed] xauth/stable,now 1:1.0.9-1 armhf [installed,automatic] xdg-user-dirs/stable,now 0.15-2 armhf [installed,automatic] xkb-data/stable,now 2.19-1 all [installed,automatic] xml-core/stable,now 0.17 all [installed,automatic] xxd/stable,now 2:8.0.0197-4 armhf [installed] xz-utils/stable,now 5.2.2-1.2 armhf [installed] zlib1g/stable,now 1:1.2.8.dfsg-5 armhf [installed] zlib1g-dev/stable,now 1:1.2.8.dfsg-5 armhf [installed,automatic]
From the list, we can see that the Raspbian Stretch Lite operating included Python 3, as such there was no need for me to install Python 3.
Installing Python 3 package manager (pip3) on Raspbian Stretch Lite
This version of Raspbian Stretch Lite did not install the Python 3 Package Manager by default. The Python 3 package manager will be useful for me to manage the dependencies for my Python 3 applications that I will run in the future. As such, I proceeded to install the Python 3 Package Manager.
To install the Python 3 Package Manager, I ran the following command:
sudo apt-get install python3-pip -y
Once the Python 3 package manager was installed successfully, I ran the following command to see the Python 3 Packages that are available in the system:
pip3 list
Which gave the following output:
cryptography (1.7.1) idna (2.2) keyring (10.1) keyrings.alt (1.3) pip (9.0.1) pyasn1 (0.1.9) pycrypto (2.6.1) pygobject (3.22.0) python-apt (1.1.0b5) pyxdg (0.25) SecretStorage (2.3.1) setuptools (33.1.1) six (1.10.0) wheel (0.29.0)
Installing Virtualenv on Raspbian Stretch Lite
Virtualenv is a tool that allows us to create isolated environments in the same machine. This is useful if I have to run multiple applications with conflicting python dependencies on my Raspberry Pi Zero W in the future.
To install Virtualenv, I ran the following command:
sudo apt-get install virtualenv -y
Buying your Raspberry Pi Zero W components from Amazon
If you do not have the Raspberry Pi Zero W components mentioned in this post yet, you may want to purchase them from Amazon. Simply click on the button below to add the Raspberry Pi Zero W components to your cart. You may remove anything that you already have or replace some of the components with other components.