Chromebook

A Chromebook runs ChromeOS as its operating system and historically running anything other than a web app–such as Python–was challenging.

However, that is no longer the case! You can now run Linux apps on ChromeOS which opens the door to using MiniConda to install Python 3.

Step 1: Turn On Linux (Beta)

Make sure you are logged in first. These steps won’t work if you’re still in Guest mode!

Open your Chromebook’s system settings by clicking on the Time in the lower right corner and then the Gear icon for Settings.

Time Icon

Scroll down to “Linux (Beta)” and select Turn On.

Linux Beta

Follow the prompts and at the end a Terminal window will open. You can run Linux commands here. (Tip: pin it to the dock for easy access).

Terminal

2. Download Miniconda

MiniConda is a free distribution of Python that works on Linux computers. It provides a basic implementation of Python and the ability to add additional packages manually as needed. Since disk space is at a premium, we will use this as opposed to Anaconda, its full-featured cousin, which includes many Python packages like numpy, scipy, and ipython notebook automatically.

Navigate to the MiniConda site, scroll down to the “Linux installers” section, and click on the link for 64-bit version of Python 3.7.

64 Bit Download

Once downloaded, click on the “Confirm download” pop-up and select “Keep”.

Keep Download

It’s very important to now move the installer into the “Linux files” section of your computer. Open up your files by clicking on the Launcher button in the lower left corner, then the Up arrow, and then Files under the search bar. The file will be named something like Miniconda3-latest-Linux-x86_64.sh.

Downloads

Drag it from Downloads into the Linux Files section.

Linux Files

3. Install Miniconda

Open the Terminal app from the Start? area.

Terminal Open

Confirm that the Miniconda installer is in your current directory by typing ls.

ls

Then to install it run the command sudo bash Miniconda3-latest-Linux-xs86_64.sh.

$ sudo bash Miniconda3-latest-Linux-xs86_64.sh

There will be a prompt to review the license. Click Enter to continue:

Review License

On the final step, you’ll be asked: “Do you accept the license terms? [yes no]”. Type in “yes” and press Enter.

License Terms

The next step asks where to install Miniconda. The default suggested is /root/miniconda3 however I prefer to use /opt/miniconda3 instead which is a directory commonly used for installing unbundled software packages. So type in /opt/miniconda3 instead.

Opt Miniconda

When asked, “Do you wish the installer to initialize MiniConda3 by running conda init? [yes no]” type in yes.

Initialize

And we’re done! The instructions will note that closing and re-opening the Terminal app is required. Do so.

Install Done

Set the proper permissions for the directory so that conda can add/remove software packages. Make sure to replace my username, williamsvincent, with yours which is found at the beginning of the prompt before @penguin. Also note that if you did not use the

$ sudo chown -R williamsvincent /opt/miniconda3

Permissions

4. Using Python

To run Conda–and by extension Python–enter a base environment by typing source /opt/miniconda3/bin/activate.

Activate

The new parentheses at the start of the prompt called (base) confirm the environment is active. To confirm the installed Python version, type python --version.

$ python --version
Python 3.7.4

Python Version

And then to enter Python itself, simply type python.

Python Conda

Next Steps

To learn more about Python, the book Python Crash Course is a great resource. For web development with Python, check out Django for Beginners.