CompSci How2: Setting Up Ubuntu with Python for Data Science Work on a Chromebook

This article is part of a series of brief tutorials I’m writing on performing particular tasks with computers. Indeed, this series may seem random, because I’m writing it partly with selfish intentions: I want to create an easily searched and centrally accessible archive of notes for myself, to inform both my project work and my teaching. I started compiling these tutorials as Word documents on my computer, but that seemed a bit too selfish. So, I will now post these how-to’s on this forum so that others can find them, read them, and use them.

Setting Up Ubuntu Linux with Python for Data Scientists on a Chromebook

First, I recommend reading these articles, because they inspired the work I’m presenting here and provide some very helpful background.

As university budgets for new computers tend to be slim to non-existent, I’m searching as Department Chair for affordable options for lab computers. Our enrollment has been growing, we are taking over additional lab space, and we need computers for that lab space. Chromebooks are usually very inexpensive computers with modest specifications that run the Chromium operating system. Google designed Chromium to run on limited hardware. Some Chromebooks are ARM-based, and some are Intel-based. You will have better luck running a wider variety of Linux applications if you choose an Intel-based Chromebook.

In Chromium, the central interface is the Chrome web browser, and all applications run inside that browser. But Chromium actually is implemented on top of a variation of the Unix operating system. By entering Developer Mode, it is possible to access the underlying Unix operating system through a command prompt. Using the command prompt, then, you can install other operating systems, applications, and graphical user interfaces.

The articles linked above describe how to access Developer Mode on your Chromebook. (In addition to enabling Developer Mode, I recommend enabling debugging features by clicking on the “Enable debugging features” link that appears on the first Welcome screen, since that will enable you to load operating systems from usb drives and ssh into the device.) Those articles then recommend an application called Crouton, a tool for managing multiple operating systems and their corresponding user interfaces. Crouton can host multiple Unix environments through what are called chroots. The articles describe how to install Crouton and use it to manage chroots  I’ll pick up from there, assuming you’ve installed Crouton and created your first chroot in the process.

Open a terminal by typing Ctrl+Alt+T. You’ll be in the crosh terminal, Chromium’s default shell.

Then type shell to get into bash shell, the most popular command-line instruction language for Unix systems. Even though crosh is the default command line interface for Chromebooks, bash is available.

Once you’ve enabled bash, load the Linux environment you installed in Crouton by following the instructions in the linked articles. To do that, type the following:

sudo enter-chroot

This will mount (i.e. activate) the default chroot (named xenial) in Crouton.

(I ran into a problem at this point, because it kept asking me for the admin password for chronos, which I never had an opportunity to set. To fix this, I had to type ctrl+alt+left_arrow to enter the developer console. There I was able to enter root and the machine’s password to get access to the root command shell, at which point I was able to issue the command chromeos-setdevpasswd to enter the password from sudo on chronos.)

You’ll then have the opportunity to launch a graphical interface to make interacting with the Linux environment easier. To do that, type startxfce4, which will open the graphical user interface xfce for your Ubuntu installation.

I’m particularly interested in getting Python and some libraries for data science studies running. If we can get Python running well on these Chromebook-turned-Ubuntu boxes, then this might be a viable solution. So that’s what I’ll focus on for the rest of this tutorial.

Fortunately, Ubuntu already comes with both Python 3 and Python 2.7. You can run Python 3 using the python3 command Python 2.7 using the python2.7 command. We do a lot of data science activity in Computer Science, and so there are libraries that would be useful to have installed in Python 3, such as matplotlib. To install new libraries, you usually need Python’s pip tool. Here’s how to install it:

Open a terminal in xfce by clicking on the Terminal shortcut.

Type this to install the pip Python installation tool:

sudo apt-get install python3-pip

We’ll install matplotlib momentarily, but first note that matplotlib requires a library called tkinter. To install tkinter, type this:

sudo apt-get install python3-tk

Then you can install matplotlib, like so:

pip3 install matplotlib

Another popular package for data science activity is numpy. You can install that in an almost identical manner:

pip3 install numpy

Other packages can be installed similarly.

Of course, if you’re a fan of the Anaconda Python suite, you can install that instead of installing these librariess manually, since Anaconda includes almost everything a data scientist needs. To install Anaconda, you could do this:



and proceed through the text-based installation process. This will install Anaconda for Python 3 in the subdirectory anaconda3. Since Anaconda is installed in a single directory, uninstalling it is easy. Simply switch to the installation directory and type rm -rf * to remove Anaconda.

To make it easier to run the Anaconda version of Python, you should set up a symbolic link. For example, to define ana to be the keyword for launching Anaconda’s version of Python, you could type this:

ln -s ~/anaconda3/bin/python3 ana

You could then run Anaconda’s version of python by typing this at the command prompt:


Another way to do this is to edit your .bashrc file to include a new environment variable. Edit .bashrc by typing

vi .bashrc

Add the following line to the file and save it:

export ana=”~/anaconda3/bin/python3″

The .bashrc file is executated at startup, but you can also run it immediately by typing this at the command line:


To shut down the chroot, simply choose Applications >> Log Out from the main menu in xfce, and then type exit in the resulting terminal window. That will unmount the chroot.

To switch between Chromium and your chroot, use the key combinations Ctrl+Alt+Shift+Back and Ctrl+Alt+Shift+Forward

You’ll probably also want to configure git so that you can manage the software you write. At the ubuntu prompt, type this:

sudo apt-get update

sudo apt-get install git-core

git config –global “your user name”

git config –globals “your email address”

So far, the idea of building a Linux lab using these inexpensive Chromebooks is intriguing. Of course, because of the limited computing power of Chromebooks, we won’t be able to do any heavy-duty number-crunching with these. Still, a Linux-equipped Chromebook could be a good option for students to use to get used to the tools.

A downside is that students will have to be careful not to accept the option to restore the machine to the factory default setting in which Developer Mode is disabled. Ideally, we could find a way to disable that option on startup.

About Ray Klump

Associate Dean, College of Aviation, Science, and Technology at Lewis University Director, Master of Science in Information Security Lewis University,, You can find him on Google+.

One thought on “CompSci How2: Setting Up Ubuntu with Python for Data Science Work on a Chromebook

  1. Vince
    November 17, 2017 at 12:21 am

    Hi. Thanks for this post.

    What do you think about using the Crouton method vs dual-booting to an Ubuntu-based distro such as GalliumOS? Do you see any performance difference between Crouton vs dual-booting?

    Also, what Chromebooks were you using? There is a Chromebook (Asus Chromebook Flip C302CA) that has 4GB RAM, 64GB SSD, and an Intel Core m3 (Skylake) processor. What do you think about data science on a machine like that using Crouton?

Leave a Reply

Your email address will not be published. Required fields are marked *