I will be using a Google Chromebook Pixel (2015) in this tutorial, but the steps should apply to other Chromebooks as well.
I am taking a different approach - with Termux and Chrome Remote Desktop for local and cloud-based work. For the cloud option, we will set up a virtual machine on AWS or Google Cloud, and will use the Chromebook as a thin client connecting to the VM via Remote Desktop or ssh. Most of the steps below (installing packages) are to support local Python coding on the Chromebook itself.
Step 0: (optional) install Chrome Remote Desktop
Get it from the Chrome Webstore here:
Step 1: install Termux
Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system can be found in the Google Play Store, and additional packages can be added using the APT package manager.
Step 2: launch Termux, and update your system
apt update apt upgrade
Step 3: install coreutils
Installing coreutils will enable the basic file, shell, and text manipulation functions (such as mkdir or ls -la):
apt install coreutils
Step 4: install OpenSSH
apt install openssh
Step 5: install Git
apt install git
Step 6: (optional) generate a new SSH key pair for connecting to your code repository
Key size of 2048 or 4096 bits is recommended.
ssh-keygen -t rsa -b 4096 - C "email@example.com"
You may want to copy the contents of the resulting public key (id_rsa.pub) to GitHub, Unfuddle, BitBucket, or whatever platform you use for source code repositories.
Step 7: give Termux access to external storage
This command ensures that an app-private folder on external storage is created (if external storage exists), it also creates a folder $HOME/storage. See detailed explanation of this command here.
Step 8: install Numpy and Scipy, the easy way
According to Termux Wiki, Termux user "its pointless" (live_the_dream) has packaged Numpy and Scipy and maintains a termux repository with these and many other useful packages. It includes gcc-7, gfortran, octave, r-cran (R language), rustc (with cargo), scipy and lots of games. To add this repository, execute:
pkg install wget $PREFIX/bin/wget https://its-pointless.github.io/setup-pointless-repo.sh bash setup-pointless-repo.sh
You can read about this (or other community members') repository here.
It's always a good idea to see what a shell script does before executing it. Here's the complete code:
#!/data/data/com.termux/files/usr/bin/sh # Get some needed tools. coreutils for mkdir command, gnugp for the signing key, and apt-transport-https to actually connect to the repo apt-get update apt-get --assume-yes upgrade apt-get --assume-yes install coreutils gnupg wget # Make the sources.list.d directory mkdir $PREFIX/etc/apt/sources.list.d # Write the needed source file echo "deb https://its-pointless.github.io/files/ termux extras" > $PREFIX/etc/apt/sources.list.d/pointless.list # Download signing key from https://its-pointless.github.io/pointless.gpg wget https://its-pointless.github.io/pointless.gpg apt-key add pointless.gpg # Update apt apt update
The script installs gnupg on your device and downloads and adds a public key to your apt keychain ensuring that all subsequent downloads are from the same source.
Step 9: set up virtualenv
You can create a virtual environment called ".venv", using the --system-site-packages option. This should make your virtual environment inherit packages from /usr/lib/python3.4/site-packages (or wherever your global site-packages directory is). This can be used if you have control over the global site-packages directory, and you want to depend on the packages there.
python -m venv .venv --system-site-packages source .venv/bin/activate
If you want isolation from the global system, do not pass the --system-site-packages option when you create your virtualenv:
python -m venv .venv source .venv/bin/activate
This will prevents your new virtualenv from inheriting from the global site packages, so everything will need to be installed locally.
If successful, your shell prompt will now display the name of your virtualenv:
I will update this article as I install more things.