Frequently Asked Questions
Colaboratory, or “Colab” for short, is a product from Google Research. Colab allows anybody to write and execute arbitrary python code through the browser, and is especially well suited to machine learning, data analysis and education. More technically, Colab is a hosted Jupyter notebook service that requires no setup to use, while providing free access to computing resources including GPUs.
Yes. Colab is free to use.
Colab resources are not guaranteed and not unlimited, and the usage limits sometimes fluctuate. This is necessary for Colab to be able to provide resources for free. For more details, see Resource Limits
Jupyter is the open source project on which Colab is based. Colab allows you to use and share Jupyter notebooks with others without having to download, install, or run anything.
Colab notebooks are stored in Google Drive, or can be loaded from GitHub. Colab notebooks can be shared just as you would with Google Docs or Sheets. Simply click the Share button at the top right of any Colab notebook, or follow these Google Drive file sharing instructions.
If you choose to share a notebook, the full contents of your notebook (text, code, output, and comments) will be shared. You can omit code cell output from being saved or shared by using Edit > Notebook settings > Omit code cell output when saving this notebook. The virtual machine you’re using, including any custom files and libraries that you’ve setup, will not be shared. So it’s a good idea to include cells which install and load any custom libraries or files that your notebook needs.
Yes. Choose "Upload notebook" from the File menu.
You can search Colab notebooks using Google Drive. Clicking on the Colab logo at the top left of the notebook view will show all notebooks in Drive. You can also search for notebooks that you have opened recently using File > Open Recent.
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.
You can download any Colab notebook that you’ve created from Google Drive following these instructions, or from within Colab’s File menu. All Colab notebooks are stored in the open source Jupyter notebook format ( .ipynb).
Selecting Runtime > Factory reset runtime to return all managed virtual machines assigned to you to their original state. This can be helpful in cases where a virtual machine has become unhealthy e.g. due to accidental overwrite of system files, or installation of incompatible software. Colab limits how often this can be done to prevent undue resource consumption. If an attempt fails, please try again later.
drive.mount()sometimes fail saying "timed out", and why do I/O operations in
drive.mount()-mounted folders sometimes fail?
Google Drive operations can time out when the number of files or subfolders in a folder grows too large. If thousands of items are directly contained in the top-level "My Drive" folder then mounting the drive will likely time out. Repeated attempts may eventually succeed as failed attempts cache partial state locally before timing out. If you encounter this problem, try moving files and folders directly contained in "My Drive" into sub-folders. A similar problem can occur when reading from other folders after a successful
drive.mount(). Accessing items in any folder containing many items can cause errors like
OSError: [Errno 5] Input/output error (python 3) or
IOError: [Errno 5] Input/output error (python 2). Again, you can fix this problem by moving directly contained items into sub-folders.
Note that "deleting" files or subfolders by moving them to the Trash may not be enough; if that doesn't seem to help, make sure to also Empty your Trash.
In order to be able to offer computational resources for free, Colab needs to maintain the flexibility to adjust usage limits and hardware availability on the fly. Resources available in Colab vary over time to accommodate fluctuations in demand, as well as to accommodate overall growth and other factors.
Colab is able to provide free resources in part by having dynamic usage limits that sometimes fluctuate, and by not providing guaranteed or unlimited resources. This means that overall usage limits as well as idle timeout periods, maximum VM lifetime, GPU types available, and other factors vary over time. Colab does not publish these limits, in part because they can (and sometimes do) vary quickly.
The types of GPUs that are available in Colab varies over time. This is necessary for Colab to be able to provide access to these resources for free. The GPUs available in Colab often include Nvidia K80s, T4s, P4s and P100s.
There is no way to choose what type of GPU you can connect to in Colab at any given time. GPUs are sometimes prioritized for users who use Colab interactively rather than for long-running computations, or for users who have recently used less resources in Colab. As a result, users who use Colab for long-running computations, or users who have recently used more resources in Colab, are more likely to run into usage limits and have their access to GPUs temporarily restricted. Users with high computational needs may be interested in using Colab’s UI with a local runtime running on their own hardware.
Note that using Colab for cryptocurrency mining is disallowed entirely, and may result in your account being restricted for use with Colab altogether.
Notebooks run by connecting to virtual machines that have maximum lifetimes that can be as much as 12 hours. Notebooks will also disconnect from VMs when left idle for too long. Maximum VM lifetime and idle timeout behavior may vary over time, or based on your usage. This is necessary for Colab to be able to offer computational resources for free.
The amount of memory available in Colab virtual machines varies over time (but is stable for the lifetime of the VM). (Adjusting memory over time allows us to continue to offer Colab for free.) You may sometimes be automatically assigned a VM with extra memory when Colab detects that you are likely to need it.
Resources in Colab are prioritized for users who have recently used less resources, in order to prevent the monopolization of limited resources by a small number of users. To get the most out of Colab, consider closing your Colab tabs when you are done with your work, and avoid opting for a GPU when it is not needed for your work. This will make it less likely that you will run into usage limits in Colab.
In 2014 we worked with the Jupyter development team to release an early version of the tool. Since then Colab has continued to evolve, guided by internal usage.
Colab focuses on supporting Python and its ecosystem of third-party tools. We're aware that users are interested in support for other Jupyter kernels (eg R or Scala). We would like to support these, but don't yet have any ETA.
Open any Colab notebook. Then go to the Help menu and select ”Send feedback...”.
Colab uses a generic monospace font for the editor. You can configure what font family is used for monospace in most modern browsers. Here's a few common ones:
- In Firefox, follow the steps provided in the Firefox support documents to configure the "Monospace" font.
- In Chrome, navigate to "chrome://settings/fonts" and modify the section labeled "Fixed-width font".
The Python development team has declared that Python 2 will no longer be supported after January 1st, 2020. As of that date, Colab has stopped updating Python 2 runtimes, and will begin phasing out support for Python 2 in the following months.
For users, this means that for the time being, Python 2 notebooks will continue to work. However, at some point in the future Python 2 notebooks may begin to connect to a Python 3 runtime instead. To avoid surprises, we suggest migrating important notebooks to Python 3.
To change your notebook's runtime, choose Runtime > Change Runtime Type and select Python 3. For information on migrating your code from Python 2 to Python 3, see Porting Python 2 Code to Python 3 within Python's documentation.