Skip to content

Instantly share code, notes, and snippets.

@Justus-coded
Created December 21, 2020 03:36
Show Gist options
  • Save Justus-coded/0c7267937614658cf7e5ae794ffa1b31 to your computer and use it in GitHub Desktop.
Save Justus-coded/0c7267937614658cf7e5ae794ffa1b31 to your computer and use it in GitHub Desktop.
Installing a module permanently in Google colab
import os, sys
from google.colab import drive
drive.mount('/content/gdrive')
#create a path to save the module
nb_path = '/content/notebooks'
os.symlink('/content/gdrive/My Drive/Colab Notebooks', nb_path)
sys.path.insert(0, nb_path)
#isntall the module in the
!pip install --target=$nb_path catboost
#load the module in a new notebook
import sys
sys.path.append('/content/gdrive/My Drive/Colab Notebooks')
#Import the module
import catboost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment