Home > front end >  Google-Colab package update permanent
Google-Colab package update permanent

Time:02-06

I've been working on a notebook for some data science project, but I came across this issue with importing updated packages. I'm making plots using matplotlib. Every time I open the notebook, Google Colab imports version 3.2.2.

import matplotlib
matplotlib.__version__ ## returns 3.2.2

Obviously, I tried updating the package using !pip install matplotlib --upgrade, and this works fine. After restarting the runtime, I now have the updated version of matplotlib (3.5.1). But whenever the session terminates, I am getting errors again on the plots I use because matplotlib's version is reverted back to 2.2.2. I tried using !pip3 as suggested in this StackOverflow question, but I still get the same problem. How do I permanently upgrade a package in Google Colab?

CodePudding user response:

After several searches, there seems to be no way to do that by default. As explained from the FAQs of Google Colaboratory:

Code is executed in a virtual machine private to your account. Virtual machines are deleted when idle for a while, and have a maximum lifetime enforced by the Colab service.

This article, however, is worth a shot. I'll keep installing for now.

  •  Tags:  
  • Related