Home » Linux & Python Packages for My Raspberry Pi

Linux & Python Packages for My Raspberry Pi

Raspberry Pi + Python Logo + RPi LogoI have two Raspberry Pi’s (RPi) and will likely have more as proceed deeper into the projects I have identified.  Not all the RPi’s will be configured the same and I’m using this page to document what Linux and Python packages I have loaded.

My Raspberry Patch

RPi Broad

Linux Packages

RedRPi

Synaptic, Vim, PyRoom, Git, Chromium, Apache, Python, IPython, matplotlib, basemap, numpy, Pandas, PyQt4, Conky, SendEmail, SSHFS, ALSA, Festival, Flite, dos2unix, x11-apps, x11-xserver-utils, xterm, fonts-inconsolata

BlackRPi

Synaptic, Vim, Git, Chromium, Python, SSHFS, Wireshark, Microcom, Arduino, dos2unix

Given that the Raspberry Pi (RPi) is a relatively new devices, you can expect the software for this platform to undergo frequent updates.   First you have the RPi’s Linux operating system (OS) (in my case Occidentalis, which is built on top of Raspbian).  This software’s is primary made of the many stable Linux utilities with some less stable RPi extensions and the RPi kernel.  Then you have the RPi firmware that gets regular updates from the RPi development community.  And finally you have any of the applications and utilities that you might have gotten from other sources that are not part of the normal RPi Linux distribution.  This could include things like WebIOPi but also includes packages for Python.

Do Your House Cleaning First
I’m loading software via the Linux apt-get utility and you need to make sure its database is up to date. First thing to do is to update apt-get’s local database with server’s pkglist’s files.  Then checks for outdated packages in the system and automatically upgrades them.  Execute the following commands:

sudo apt-get update
sudo apt-get upgrade

To do similar updates for Python, use the following:

sudo easy_install -U distribute

Search for Package or Package Description
Some times you don’t know package name but aware of some keywords to search the package.  To search for packages, use the following:

apt-cache search "text-to-search"
apt-cache search "text-to-search" | grep "more-search-text"

Erase Package and Configuration File
To completely erase from you Linux system, you can use the following:

apt-get --purge remove {package-name}

List All Installed Packages
You can use following command to find out all Linux package names available on your system:

dpkg -l

Suppose you want to find out if a specific package is installed, say its “apache-perl”, you type the command:

dpkg -s apache-perl

To get a list of all the Python packages installed you can use:

pip freeze --local

Linux and Python Packages

Python
Python is an interpreted, object-oriented, high-level programming language  attractive for rapid application development, as well as for use as a scripting or glue language to connect existing components together. Python’s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance.  While the Raspberry Pi Linux distribution is likely to already have some python packages installed, execute the following to make sure you have all that is needed (see distribute and easy_install for more details).

sudo apt-get install python
sudo apt-get install python-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install python-setuptools
sudo apt-get install python-pip

With this done, now its time to install the required Python libraries but first, update the Python distribution by running

sudo easy_install -U distribute

Finally you can install the Raspberry Pi GPIO (General Purpose Input/Ouput) and other packages:

sudo pip install RPi.GPIO
sudo pip install pySerial
sudo pip install nose

sudo pip install cmd2

For 2D plotting, install the matplotlib library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code.The matplotlib basemap toolkit is a library for plotting 2D data on maps in Python. numpy is a foundation package for scientific computing with Python.  Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data.  The package scipy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, ODE solvers, and other tasks common in science and engineering. The The basic data structure in SciPy is a multidimensional array provided by the NumPy module.  And to round things off, pandas is a Python package providing fast, flexible, and expressive data structures designed to make working with structured (tabular, multidimensional, potentially heterogeneous) and time series data both easy and intuitive. It aims to be the fundamental high-level building block for doing practical data analysis in Python.

sudo apt-get install python-matplotlib
sudo apt-get install python-mpltoolkits.basemap
sudo apt-get install python-numpy
sudo apt-get install python-scipy
sudo apt-get install python-pandas

PyQt4 PyQt is a set of Python  bindings for Digia’s Qt cross platform framework that is widely used for developing application software with a graphical user interface (GUI).

sudo apt-get install python-qt4

IPython can do much more than the standard Python. IPython is an interactive shell for the Python programming language that offers enhanced introspection, additional shell syntax, tab completion and rich history. IPython allows non-blocking interaction with Tkinter, GTK, Qt and wxWidgets (the standard Python shell only allows interaction with Tkinter).  IPython provide a rich text web interface (i.e. Web application that has many of the characteristics of desktop application software delivered by way of a browser) called Notebook.  For scientific and engineering work, it is often presented as a companion tool to Matplotlib.

sudo apt-get install ipython ipython-doc ipython-notebook ipython-qtconsole

X Window Utilities
The x11-apps package provides a miscellaneous assortment of X applications that ship with the X Window System, including xclock (graphical clocks), xconsole (monitors system console messages), xeyes (demo program … eyes track the pointer), xload (monitor for the system load average), xwd (utility for taking screenshots), etc. xterm is the standard terminal emulator for the X Window System. The x11-xserver-utils package provides a miscellaneous assortment of X Server utilities that ship with the X Window System, including xrdb (a tool to manage the X server resource database), xsetroot (a tool for tailoring the appearance of the root window)

sudo apt-get install x11-apps
sudo apt-get install x11-xserver-utils
sudo apt-get install xterm

Synaptic
Synaptic is a graphical package management program for Linux software. It provides the same features as the apt-get command line utility with a X Windows GUI front-end.  While I will not be using X Windows at this moment, in the future I will and synaptic is a very nice alternative to apt-get when in in X Windows.

sudo apt-get install synaptic

Vim
Vim is a highly configurable text editor and widely available for many different platforms.  Emacs also has a large following, but I think everyone needs to be prepared to use vim if your serious about Linux.  The RPi Linux distribution appears to have vi loaded but vim is a superior tool.

sudo apt-get install vim
sudo apt-get install vim-gtk

Vim will work for you just fine right out of the box but its real power is demonstrated by tapping into it configuration via the .vimrc file. Configuring vim is a major topic, covered by many web sites and books, but you’ll find my .vimrc file on github.

PyRoom
PyRoom is a a fullscreen editor without buttons, widgets, formatting options, menus and with only the minimum of required dialog windows, it doesn’t have any distractions and lets you focus on writing and only writing.  It is the polar opposite of Vim, and as such, is a good editor for the novice or casual user, but requires X Windows and Python.

sudo apt-get install pyroom

Git
Given that I plan to hack some to-be-determined applications using the RPi, I should consider establish some tools for  source code management. The last time I did serious software development in Linux (really Unix), I was using Source Code Control System (SCCS). The tools are much improved now and git is hands down the way to go.

sudo apt-get install git

Chromium
We all have a favorite browser and I choose chromium for my RPi.  Chromium serves as a base for Google Chrome, which is Chromium re-branded (name and logo) with very few additions.

sudo apt-get install chromium

Apache
Apache is a very popular web server and I will make use of it for any web application that are required. It can be installed, along with its required scripting language, via the command below.

sudo aptitude install apache2 php5

Conky
Conky is a system monitor tool for X Windows.  Conky is highly configurable and is able to monitor many system variables including the status of the CPU, memory, swap space, disk storage, temperatures, processes, network interfaces, battery power, system messages, e-mail inboxes, Linux updates, runs many popular music players, and much more.  To install the standard Conky package, use the following:

sudo apt-get install conky-std

SendEmail
sendEmail is a command-line outgoing email SMTP client. It is used for sending e-mails from the command line, and can therefore be easily embedded into other applications or scripts. It great for integrating email into shell or python scripts. All fields of the sent emails (such as the sender and reply-to addresses, recipients, message body, subject and attachments) are specified as command-line arguments, as well as other parameters (such as the SMTP server name, user and password for SMTP account, network timeouts, etc.).

sudo apt-get install sendemail

SSHFS
SSHFS (SSH Filesystem) is a file system client to mount and interact with directories and files located on a remote server or workstation. SSHFS requires no special software on the remote side, just a SSH server with support for the SFTP extension. SSHFS is an alternative to traditional network file system, such as NFS, OpenAFS or Samba. Setting up these network file systems requires administrator access on both systems, but not for SSHFS.

sudo apt-get install sshfs

Advanced Linux Sound Architecture (ALSA)
The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux operating system. Is structured as Linux kernel module and provides an API for device drivers for sound cards.

sudo apt-get install alsa-utils
sudo apt-get install mpg321
sudo apt-get install lame

Festival / Flite
The Festival Speech Synthesis System offers a general framework for building speech synthesis systems as well as including examples of various modules. As a whole it offers full text to speech through a number APIs: from shell level, though a Scheme command interpreter, as a C++ library, from Java, and an Emacs interface. Festival is multi-lingual (currently English (British and American), and Spanish) though English is the most advanced. Other groups release new languages for the system. And full tools and documentation for build new voices are available through Carnegie Mellon’s FestVox project.

Flite (festival-lite) is a small, fast run-time synthesis engine developed at CMU and primarily designed for small embedded machines and/or large servers. Flite is designed as an alternative synthesis engine to Festival for voices built using the FestVox suite of voice building tools.

sudo apt-get install festival
sudo apt-get install flite

Wireshark
Wireshark (originally named Ethereal) is a free and open-source packet analyzer. Wireshark is very similar to tcpdump, but has a graphical front-end, plus some integrated sorting and filtering options.  Wireshark allows the user to put network interface controllers that support promiscuous mode into that mode, in order to see all traffic visible on that interface, not just traffic addressed to one of the interface’s configured addresses and broadcast/multicast traffic.

sudo apt-get install wireshark

Microcom
Microcom is a minimalistic terminal program for accessing devices (e.g. switches) via a serial connection. it features connection via rs232 serial interfaces (including setting of transferrates) as well as in “telnetmode” as specified in rfc2217.

sudo apt-get install microcom

Arduino
Arduino is a single-board microcontroller designed to make the process of using electronics in multidisciplinary projects more accessible. The hardware consists of a simple open source hardware design for the Arduino board with an Atmel AVR processor and on-board input/output support. Arduino is a descendant of the open-source Wiring platform and is programmed using a Wiring-based language (syntax and libraries), similar to C++ with some slight simplifications and modifications.  What is installed here is the Arduino  integrated development environment (IDE).

sudo apt-get install arduino

To run the Arduino IDE, simple type the following on the RPi command line:

arduino &

Dos2Unix
I mount my Window PC’s Dropbox directory on my RPi so I can work in both environments at will. While editing files on a machine running some form of Windows and uploading them to a Linux server is convenient, it can cause unforeseen complications. Windows-based text editors put one set of special characters at the end of lines (i.e. carriage return and line break = '\r\n'), while Unix/Linux puts other characters (i.e. line break = '\n'). This is normally harmless, but some applications on a Linux cannot understand these characters and can cause Linux to not respond correctly.

The best example of Linux behaving badly (and the only one I know)  is the execution of “shebang” or the “#!…” at the top of a bash, python, perl, etc. script.  If you edit these files in DOS, then move them to Linux, shebang will stop working.  Editing them under DOS is the origin of the problem, since a DOS based text editor will inject the extra carriage return character at the end of the text line.

To fix this problem, you can quickly convert an ASCII text file from DOS format (carriage return and line break) to the Unix format (line break), you can use the tool dos2unix.  Run this utility on the effected file and shebang should work once again.

sudo apt-get install dos2unix

Fonts
The native fonts on RPi are nothing to get excited about and can be hard on the eyes. I prefer Inconsolata which claims to be designed primarily for use on the screen and high resolution rendering. It is a monospaced font designed for source code listing, terminal emulators, and similar uses.

sudo apt-get install fonts-inconsolata

A similar font is Consolas and is what I use with my PC based X server (Cygwin/X) and on my iPad’s iSSH X server.


14 Comments

  1. Supra says:

    Can I do this step by step?
    sudo apt-get install python
    sudo pip install RPi.GPIO

    Then open IDE3 to write code

    then run it
    sudo python .py

    Is this correct as above?

    I appreciate ur helping.

    Supra

  2. RGR says:

    Very handy cut-and-paste reference for IPython / NumPy / Pandas. Thanks!

  3. […] Pour aller plus loin : Linux & Python Packages for My Raspberry Pi […]

  4. Thomas says:

    Thank you for this list!

  5. NewtownGuy says:

    I’m running the latest Raspian with the latest updates and upgrades. However, the command, easy_install, is no where to be found. How do I fix this ? Also, how do I install Inline::Python ?

  6. […] Pour aller plus loin : Linux & Python Packages for My Raspberry Pi […]

  7. I find filezilla very useful for transferring files between my PC and RPI. In site manager menu create a new site for your RPI using it’s IP or network name (if you have samba configured on RPI) Set protocol to SFTP (SSH) add normal user login and password. login and set your PC folder location and the folder location on your RPI. You can then easily navigate copy rename transfer files back and forth etc using drag and drop/double click, slow click to rename, change permissions, Etc. It comes in handy for me since I like to do development work on my windows PC rather than on the RPI. Another advantage is that I always have a backup copy if the RPI goes down.

  8. kevin says:

    Hi all, perhaps some body could assist me do I need to go on to the inet to download dev,pip.GPIO files or are they on the SIM card..because I not able to find them

  9. Michael says:

    Many thanks for your information. I bought a Rpi 2 model B in August 2015 starting to play with it. Quite interesting with many projects. Plan to buy one more

  10. sEAN says:

    sudo apt-get install python-pandas
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    libaec0 libamd2 libblosc1 libdsdp-5.8gf libglpk40 libgsl2 libhdf5-100 libsz2
    libzstd1 python-antlr python-bs4 python-cvxopt python-html5lib python-jdcal
    python-joblib python-lxml python-nose python-numexpr python-openpyxl
    python-pandas-lib python-patsy python-py python-pytest python-statsmodels
    python-statsmodels-lib python-tables python-tables-data python-tables-lib
    python-webencodings python-xlrd python-xlwt
    Suggested packages:
    libiodbc2-dev default-libmysqlclient-dev gsl-ref-psdoc | gsl-doc-pdf
    | gsl-doc-info | gsl-ref-html python-genshi python-lxml-dbg python-lxml-doc
    python-coverage python-nose-doc python-pandas-doc python-patsy-doc
    subversion python-pytest-xdist python-mock python-statsmodels-doc
    python-tables-doc python-netcdf vitables
    The following NEW packages will be installed:
    libaec0 libamd2 libblosc1 libdsdp-5.8gf libglpk40 libgsl2 libhdf5-100 libsz2
    libzstd1 python-antlr python-bs4 python-cvxopt python-html5lib python-jdcal
    python-joblib python-lxml python-nose python-numexpr python-openpyxl
    python-pandas python-pandas-lib python-patsy python-py python-pytest
    python-statsmodels python-statsmodels-lib python-tables python-tables-data
    python-tables-lib python-webencodings python-xlrd python-xlwt
    0 upgraded, 32 newly installed, 0 to remove and 5 not upgraded.
    Need to get 15.0 MB of archives.
    After this operation, 79.4 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Abort.

    sudo apt-get install ipython ipython-doc ipython-notebook ipython-qtconsole
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package ipython-notebook is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Unable to locate package ipython-doc
    E: Package ‘ipython-notebook’ has no installation candidate

    sudo apt-get install xterm
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    libutempter0
    Suggested packages:
    xfonts-cyrillic
    The following NEW packages will be installed:
    libutempter0 xterm
    0 upgraded, 2 newly installed, 0 to remove and 5 not upgraded.
    Need to get 624 kB of archives.
    After this operation, 1,739 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Abort.

    sudo apt-get install xterm
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    libutempter0
    Suggested packages:
    xfonts-cyrillic
    The following NEW packages will be installed:
    libutempter0 xterm
    0 upgraded, 2 newly installed, 0 to remove and 5 not upgraded.
    Need to get 624 kB of archives.
    After this operation, 1,739 kB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    Abort.

    sudo apt-get install synaptic
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    docbook-xml libcairo-perl libept1.5.0 libglib-perl libgtk2-perl
    libpango-perl libpcre2-8-0 librarian0 libvte-2.91-0 libvte-2.91-common
    rarian-compat sgml-data
    Suggested packages:
    docbook docbook-dsssl docbook-xsl docbook-defguide libfont-freetype-perl
    libgtk2-perl-doc perlsgml w3-recs opensp libxml2-utils dwww menu deborphan
    apt-xapian-index software-properties-gtk
    The following NEW packages will be installed:
    docbook-xml libcairo-perl libept1.5.0 libglib-perl libgtk2-perl
    libpango-perl libpcre2-8-0 librarian0 libvte-2.91-0 libvte-2.91-common
    rarian-compat sgml-data synaptic
    0 upgraded, 13 newly installed, 0 to remove and 5 not upgraded.
    Need to get 4,916 kB of archives.
    After this operation, 18.6 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Abort.
    sudo apt-get install vim-gtk
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    liblua5.2-0 vim-gui-common
    Suggested packages:
    cscope vim-doc
    The following NEW packages will be installed:
    liblua5.2-0 vim-gtk vim-gui-common
    0 upgraded, 3 newly installed, 0 to remove and 5 not upgraded.
    Need to get 1,237 kB of archives.
    After this operation, 2,994 kB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Abort.

    sudo apt-get install vim-gtk
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    liblua5.2-0 vim-gui-common
    Suggested packages:
    cscope vim-doc
    The following NEW packages will be installed:
    liblua5.2-0 vim-gtk vim-gui-common
    0 upgraded, 3 newly installed, 0 to remove and 5 not upgraded.
    Need to get 1,237 kB of archives.
    After this operation, 2,994 kB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    Abort.

    sudo apt-get install chromium
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package chromium is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
    chromium-bsu

    E: Package ‘chromium’ has no installation candidate

    sudo aptitude install apache2 php5
    No candidate version found for php5
    Unable to apply some actions, aborting

    sudo apt-get install conky-std
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    conky-std is already the newest version (1.10.6-1).
    0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

    sudo apt-get install sendemail
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    libio-socket-inet6-perl libsocket6-perl
    Suggested packages:
    libio-socket-ssl-perl libnet-ssleay-perl
    The following NEW packages will be installed:
    libio-socket-inet6-perl libsocket6-perl sendemail
    0 upgraded, 3 newly installed, 0 to remove and 5 not upgraded.
    Need to get 75.6 kB of archives.
    After this operation, 246 kB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    Abort.

    sudo apt-get install wireshark
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    geoip-database-extra libc-ares2 libjs-openlayers liblua5.2-0
    libnl-route-3-200 libpcap0.8 libqgsttools-p1 libqt5multimedia5
    libqt5multimedia5-plugins libqt5multimediaquick-p5 libqt5multimediawidgets5
    libqt5qml5 libqt5quick5 libsmi2ldbl libwireshark-data libwireshark8
    libwiretap6 libwscodecs1 libwsutil7 wireshark-common wireshark-qt
    Suggested packages:
    qt5-qmltooling-plugins snmp-mibs-downloader wireshark-doc
    The following NEW packages will be installed:
    geoip-database-extra libc-ares2 libjs-openlayers liblua5.2-0
    libnl-route-3-200 libpcap0.8 libqgsttools-p1 libqt5multimedia5
    libqt5multimedia5-plugins libqt5multimediaquick-p5 libqt5multimediawidgets5
    libqt5qml5 libqt5quick5 libsmi2ldbl libwireshark-data libwireshark8
    libwiretap6 libwscodecs1 libwsutil7 wireshark wireshark-common wireshark-qt
    0 upgraded, 22 newly installed, 0 to remove and 5 not upgraded.
    Need to get 30.1 MB of archives.
    After this operation, 118 MB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    Abort.
    IMP
    sudo apt-get install arduino
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following additional packages will be installed:
    arduino-core avr-libc avrdude binutils-avr extra-xdg-menus gcc-avr libftdi1
    libjna-java libjna-jni librxtx-java
    Suggested packages:
    arduino-mk avrdude-doc task-c-devel gcc-doc libjna-java-doc
    The following NEW packages will be installed:
    arduino arduino-core avr-libc avrdude binutils-avr extra-xdg-menus gcc-avr
    libftdi1 libjna-java libjna-jni librxtx-java
    0 upgraded, 11 newly installed, 0 to remove and 5 not upgraded.
    Need to get 21.6 MB of archives.
    After this operation, 132 MB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    Abort.
    bash: arduino: command not found

    [1]+ Exit 127 arduino

    ABOVE NEED HELP I HAVE NO KNOWLEDGE OF ABOVE Y THIS HAPPENED PL HELP

    • supra says:

      This link is 5 yrs old. U will have to get new image from raspbian stretch

      On Tue, Jul 31, 2018 at 10:33 AM Jeff’s Skinner Box wrote:

      > sEAN commented: “sudo apt-get install python-pandas Reading package > lists… Done Building dependency tree Reading state information… Done > The following additional packages will be installed: libaec0 libamd2 > libblosc1 libdsdp-5.8gf libglpk40 libgsl2 libhdf” >

Leave a comment