Installing python tar.gz (Pattern 3.6) on Google Colab

To get started I hope you have some knowledge on using Google Colab. If you are a beginner, you might want to start here. This article is written on installing Pattern 3.6 library but can be used to install any tar.gz library in Colab.

Navigation

With basic knowledge about Colab secured, let’s get started. To get started you’ll need a download link to your package (Patter 3.6). Go to the download page on pypi.org and find the library you wish to download. Then navigate in to Download Files where we can download tar.gz file of the library.

This will look something similar to the image you see below.

From the list of available options(files) locate the version that you want to download and right click on the File name, then click on copy link. The link should be something like: “https://files.pythonhosted.org/packages/1e/07/b0e61b6c818ed4b6145fe01d1c341223aa6cfbc3928538ad1f2b890924a3/Pattern-3.6.0.tar.gz”.

Now with the link secured, let’s go to Colab. To get started we first need to download the file to our Colab workspace. To do this run the following command. (!wget [link])

Command to download the file

And you should be able to see your tar.gz file in the left hand side fill managing area.

When you have the file in place, let’s go ahead and extract this inside of Colab. To do so we’ll use !sudo tar -xvf [file_name] command and it looks like this. Make sure to use your file name in place.

This will create a folder with your file name (ex: Pattern-3.6) and will have extracted content inside. I tried running the install command inside the folder and it kept on finding errors and as a work around, Lets move all the content from inside of the folder to outside. Now all of your files must be along side the file you downloaded. From here on Run Python install command as follows and you should be good to go.

I hope this article helped at least one person as it helped me finding these information. This is the method I followed when installing and I understand there might be easier and proper ways to do this.