'Google Colab not updating package?

I am trying to use seaborn==0.8.1 in an ipynb on Google colab. Here is my code:

"""General import statements and settings config."""
!pip install seaborn==0.8.1
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
pd.set_option('max_columns', 10)
color = sns.color_palette()[0]
print (sns.__version__)

However, this outputs the following:

Requirement already satisfied: seaborn==0.8.1 in /usr/local/lib/python3.6/dist-packages (0.8.1)
0.7.1

If the requirement is satisfied why am I importing the old version of Seaborn?



Solution 1:[1]

The issue here is that Colab imports seaborn at startup, before you've pip install'd the new version. If you restart your runtime after the install, you'll pick up the new version.

Solution 2:[2]

!pip install seaborn --upgrade packageName and then restart the kernel/runtime.

If you just need to upgrade seaborn in a hosted collab notebook to the latest version then run !pip install seaborn --upgrade and then restart the kernel/runtime.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Craig Citro
Solution 2 MrFun