How to save settings in sessions?

In Colaboratory, is there a way to save library settings through sessions? If so, how can I do this? I would like to know more about the Colaboratory session management in general.

Currently, every time I have to import, for example. cv2 module (since this is not available by default), I need to reinstall the module using, !pip install opencv-pythonalong with its dependencies, which provide common objects, with !apt=-get package-name.

+1
source share
1 answer

Virtual machines wait time after a period of inactivity, so you might want to structure your laptops to install custom dependencies if necessary.

A typical example is the presence of a cell at the top of your laptop, which executes commands aptand pipif necessary.

In the case of opencv, it would look something like this:

!apt install -y -qq libsm6 libxext6 && pip install -q -U opencv-python

(It makes 7 seconds for me on a new virtual machine.)

+5
source

All Articles