We can now use Chromebooks for data science or quantitative research using Chromebooks with the introduction of Linux Debian distribution via the Crostini add-on in Chrome OS! This provides us with a hybrid solution of being able to perform intitial data explorations and training simple models locally before transitioning to Google CoLab for more heavy duty number crunching! See my post on Introduction to Google Colab for more details.
This will run through the steps used setup the Pixelbook / Chromebook (I have Pixelbook) for programming in Python using the Anaconda Distribution. It assumes general knowledge of the below:
Basic general knowledge of Linux systems (i.e., changing directories, listing all files in directories)
Use of a Linux editor (i.e., vim).
Go to Settings in your Pixelbook and scroll/search to Linux (Beta).
Toggle the Linux Apps for Chrome Book option. This will install the Terminal program on to your Pixelbook.
Terminal is your access point into the Linux Debian system in the Pixelbook.
These are the customizations that I use on my Pixelbook Crostini. You don't need to follow any of these customizations, and if you have other cool things you do with your personal Chromebook Crostini setup feel free to share them with me!
Include stretch-backports to the Crostini Virtual Machine (VM) version of debian stretch by updating the source.list
Add the following the backports repository at the bottom.
Download the Linux Debian updates and upgrade and installs them. apt-get downloads the package lists from the repositories and 'updates' them to get information on the newest version of packages and their dependences. dist-upgrade actually performs the install of the latest packages and handles dependencies intelligently.
Make directory structures look nicer by installing tree.
Making fonts look nicer in terminal by installing fonts-powerline.
Install tmux, a terminal multiplexer.
Customize tmux by adding .tmux.conf in your home directory and add the following
- To make the ChromeOS shortcuts function in Terminal, press Ctrl-Shift-p in Terminal.
This will open the Profile settings for Terminal in the Chrome Browser.
Scroll to keybindings and enter the following
Install nodejs as you need this for tldr and for Jupyter Lab.
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - $ sudo apt-get install -y nodejs $ sudo apt-get install -y build-essential
tldr is a short and useful help page for commands. Upon installing, we need to update it to the latest manual. We can then test it with to see the concise help file for the conda command.
Go to the Anaconda website and download the 3.X.X version of Python for Linux. This will download an Anaconda3-x.x.x-Linux-x86_64.sh into your downloads folder.
Go to the Files app in Chrome OS and transfer the Anaconda3-x.x.x-Linux-x86_64.sh file from Downloads into the Linux files folder.
Open Terminal in your Pixelbook and ensure that you are in your home directory (i.e., /home/USERNAME)
Install the Anaconda Python distribution.
When prompted, install VSCode too (i.e., Microsoft Visual Studio Code).
Open Terminal and check that you are in your home directory (i.e., /home/USERNAME)
Use the vim editor to open the .bashrc file.
Add the following line into the .bashrc file and save. This line will add the Anaconda Python executable files into your Linux PATH.
Rerun the .bashrc file.
Activate the Python environment to check that you have successfully added Anaconda Python execuable files into your Linux PATH.
Obtain the ip address of your Linux Crostini terminal
Analyze output below.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 4: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 00:16:3e:4f:42:95 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 100.115.92.205/28 brd 100.115.92.207 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::216:3eff:fe4f:4295/64 scope link valid_lft forever preferred_lft forever
Record the second ip address which is in the 'Broadcast' section. For my system it is 100.115.92.205 but it will be different for yours. We will continue to use my ip address as an example.
Generate a jupyter_notebook_config.py in the director /home/<user>/.jupyter/.
In the /home/<user>/.jupyter/, open the file by using vim jupyter_notebook_config.py and update the following lines:
c.NotebookApp.allow_origin ='*' #allow all origins c.NotebookApp.ip = '100.115.92.205' # listen to specific IP address
Alternatively, you can request that the NoteBookApp.ip listens to all IP addresses (less secure)
c.NotebookApp.allow_origin ='*' #allow all origins c.NotebookApp.ip = '*' # listen to all IP addresses
You're now ready to start programming in Python on your Pixelbook! Feel free to use any of the following commands in Terminal:
I usually use Spyder for serious development and switch between Jupyter Lab and Jupyter `Notebook for creating the coding blog posts. anaconda-navigator is a GUI for interfacing with your conda environments and packages.