Questions tagged [google-colaboratory]
Google Colaboratory is a research tool for machine learning education and research.
google-colaboratory
7,930
questions
612
votes
48
answers
884k
views
wget/curl large file from google drive [closed]
I'm trying to download a file from google drive in a script, and I'm having a little trouble doing so. The files I'm trying to download are here.
I've looked online extensively and I finally managed ...
343
votes
39
answers
436k
views
How can I prevent Google Colab from disconnecting?
Is there a way to programmatically prevent Google Colab from disconnecting on a timeout?
The following describes the conditions causing a notebook to automatically disconnect:
Google Colab notebooks ...
266
votes
17
answers
791k
views
How to read data in Google Colab from my Google drive?
I have some data on gDrive, for example at
/projects/my_project/my_data*.
Also I have a simple notebook in gColab.
So, I would like to do something like:
for file in glob.glob("/projects/...
223
votes
24
answers
446k
views
Import data into Google Colaboratory
What are the common ways to import private data into Google Colaboratory notebooks? Is it possible to import a non-public Google sheet? You can't read from system files. The introductory docs link to ...
173
votes
6
answers
438k
views
How do I install Python packages in Google's Colab?
In a project, I have e.g. two different packages, How can I use the setup.py to install these two packages in the Google's Colab, so that I can import the packages?
159
votes
6
answers
356k
views
Changing directory in Google colab (breaking out of the python interpreter)
So I'm trying to git clone and cd into that directory using Google collab - but I cant cd into it. What am I doing wrong?
!rm -rf SwitchFrequencyAnalysis && git clone https://github.com/...
156
votes
16
answers
310k
views
Importing .py files in Google Colab
Is there any way to upload my code in .py files and import them in colab code cells?
The other way I found is to create a local Jupyter notebook then upload it to Colab, is it the only way?
149
votes
11
answers
238k
views
How do I download multiple files or an entire folder from Google Colab?
Currently, I can download files as individual files with the command
files.download(file_name)
I also tried uploading them to the drive with the below code snippet but it is uploading them as ...
146
votes
16
answers
192k
views
Methods for using Git with Google Colab
Are there any recommended methods to integrate git with colab?
For example, is it possible to work off code from google source repositories or the likes?
Neither google drive nor cloud storage can ...
133
votes
10
answers
117k
views
Google Colaboratory: misleading information about its GPU (only 5% RAM available to some users)
update: this question is related to Google Colab's "Notebook settings: Hardware accelerator: GPU". This question was written before the "TPU" option was added.
Reading multiple excited announcements ...
128
votes
17
answers
157k
views
accessing "Shared with me" with Colab
I want to get access to the files in the Google Drive's "Shared with me" directory.
In the Colab python notebook the following commands:
import os
from google.colab import drive
drive.mount('/...
123
votes
4
answers
160k
views
Can I run a Google Colab (free edition) script and then shut down my computer?
Can I run a google colab (free edition) script and then shut down my computer?
I am training several deeplearning models with crossvalidation, and therefore I would like to know if I can close the ...
117
votes
8
answers
236k
views
How to download file created in Colaboratory workspace?
I found many hints how to upload data into Colaboratory.
But now I want to do opposite -> I want to download .csv I've created in Colaboratory workspace.
How to do this?
112
votes
22
answers
91k
views
Can I use TensorBoard with Google Colab?
Is there any way to use TensorBoard when training a TensorFlow model on Google Colab?
103
votes
1
answer
61k
views
Meaning of "Power Level" on google colab
When I open a new notebook on Google Colab I see a "POWER LEVEL" indicator with a battery symbol at the top.
I can click it and choose three different power levels: low, medium and high.
I don't ...
102
votes
7
answers
117k
views
How to use R with Google Colaboratory?
Google Colaboratory supports Python version 2.7 and 3.6
I saw an example how to use Swift in Colab a while ago.
Today, I happened to run
!jupyter-kernelspec list
And found a new kernel: IRkernel
...
102
votes
5
answers
70k
views
How do I install a library permanently in Colab?
In Google Colaboratory, I can install a new library using !pip install package-name. But when I open the notebook again tomorrow, I need to re-install it every time.
Is there a way to install a ...
96
votes
9
answers
176k
views
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'
I'm trying to create a virtual environment using conda on Google Colaboratory.
However, I can't activate with the following error.
CommandNotFoundError: Your shell has not been properly configured ...
79
votes
7
answers
157k
views
Colaboratory: Can I access to my Google drive folder and file?
Google Colaboratory is really cool, but it would be more useful if I can access all my google drive files, without using standard google drive API.
Is it possible and easy? and how?
78
votes
16
answers
291k
views
Pytorch fails with CUDA error: device-side assert triggered on Colab
I am trying to initialize a tensor on Google Colab with GPU enabled.
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
t = torch.tensor([1,2], device=device)
But I am getting ...
76
votes
5
answers
231k
views
RuntimeError: CUDA out of memory. How can I set max_split_size_mb?
I found this problem running a neural network on Colab Pro+ (with the high RAM option).
RuntimeError: CUDA out of memory. Tried to allocate 8.00 GiB (GPU 0;
15.90 GiB total capacity; 12.04 GiB ...
75
votes
13
answers
148k
views
How can we use Selenium Webdriver in colab.research.google.com?
I want to use Selenium Webdriver of Chrome in colab.research.google.com for fast processing. I was able to install Selenium using !pip install selenium but the webdriver of chrome needs a path to ...
73
votes
6
answers
96k
views
How to change the theme to dark in Google Colab?
How do I change the current theme to the dark theme in Google Colab?
I need a dark theme like Jupyter notebook has.
72
votes
16
answers
380k
views
Extract Google Drive zip from Google colab notebook
I already have a zip of (2K images) dataset on a google drive. I have to use it in a ML training algorithm.
Below Code extracts the content in a string format:
from pydrive.auth import GoogleAuth
...
71
votes
4
answers
182k
views
Exporting Data from google colab to local machine
How to export data frames which are created in google colab to your local machine?
I have cleaned a data set on google colab. Now I want to export the data frame to my local machine.
df.to_csv is ...
68
votes
14
answers
97k
views
How to edit and save text files (.py) in Google Colab?
I cloned a github repo using !git clone https://github.com/llSourcell/Pokemon_GAN.git. I wanted to modify a .py file inside Colab. So i used %load filename.py as suggested here (How to load/edit/...
67
votes
5
answers
180k
views
TypeError: load() missing 1 required positional argument: 'Loader' in Google Colab
I am trying to do a regular import in Google Colab.
This import worked up until now.
If I try:
import plotly.express as px
or
import pingouin as pg
I get an error:
-----------------------------------...
62
votes
12
answers
111k
views
How to insert an inline image in Google Colaboratory from Google Drive
I am trying to insert an image in Google Colaboratory (markdown) already saved in Google Drive using this expression ![Text](https://xxxx) but it doesn't work. For example, the Colaboratory markdown ...
62
votes
1
answer
33k
views
Does Google Colab stay connected when I close my browser?
This may be a dumb question, but does a job stop running on a Colab instance when I close my browser? If not, is there a way to keep it running (i.e until it's complete)
In that same vein of thought, ...
61
votes
13
answers
52k
views
Using Kaggle Datasets in Google Colab
Is it possible to use any datasets available via the kaggle API in Google Colab? I see the Kaggle API is used in this Colab notebook, but it's a bit unclear to me what datasets it provides access to.
61
votes
7
answers
213k
views
How to read csv to dataframe in Google Colab
I am trying to read a csv file which I stored locally on my machine. (Just for additional reference it is titanic data from Kaggle which is here.)
From this question and answers I learnt that you can ...
61
votes
7
answers
66k
views
Interactive matplotlib figures in Google Colab
Normally in a jupyter notebook I would use %matplotlib notebook magic to display an interactive window, however this doesn't seem to work with google colab. Is there a solution, or is it not possible ...
60
votes
4
answers
115k
views
Get total amount of free GPU memory and available using pytorch
I'm using google colab free Gpu's for experimentation and wanted to know how much GPU Memory available to play around, torch.cuda.memory_allocated() returns the current GPU memory occupied, but how do ...
59
votes
19
answers
99k
views
How can I hide cell contents in Google Colaboratory?
I'm working through a tutorial in Google Colaboratory, and the author has handily hidden some of the solutions cells. When you click the hidden cell, it expands and becomes visible. How can I hide ...
59
votes
8
answers
184k
views
How to install CUDA in Google Colab GPU's
It seems that Google Colab GPU's doesn't come with CUDA Toolkit, how can I install CUDA in Google Colab GPU's. I am getting this error in installing mxnet in Google Colab.
Installing collected ...
59
votes
3
answers
17k
views
Code formatter like nb_black for google colab
I know that for jupyter notebooks and jupyter lab, there are available code formatter extensions such as nb_blackor blackcellmagic. However when I installed them, it doesn't seem to work on google ...
56
votes
6
answers
134k
views
Convert ipynb notebook to HTML in Google Colab
I have a Google Colaboratory Notebook for Data Analysis that I want to output as a HTML file as currently not everything loads within the Colab environment such as large Folium Heatmaps. Is it ...
55
votes
3
answers
80k
views
Setting environment variables in Google Colab
I'm trying to use the Kaggle CLI API, and in order to do that, instead of using kaggle.json for authentication, I'm using environment variables to set the credentials.
!pip install --upgrade kaggle
!...
55
votes
5
answers
19k
views
Test if notebook is running on Google Colab
How can I test if my notebook is running on Google Colab?
I need this test as obtaining / unzipping my training data is different if running on my laptop or on Colab.
54
votes
7
answers
170k
views
How to run a Python script in a '.py' file from a Google Colab notebook?
%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
return false;
}
%run rl_base.py
I run this giving error saying rl_base.py file not found. I have uploaded the same to ...
53
votes
3
answers
41k
views
How to show line numbers in Google Colaboratory?
Normally it is possible in jupyter or iPython notebooks to show lines number for a cell, however I don't see where in Google Colaboratory (Colab).
52
votes
5
answers
96k
views
Google Colab session timeout
In the FAQs it is mentioned that
Virtual machines are recycled when idle for a while, and have a maximum lifetime enforced by the system.
Are the maximum lifetime and idle times fixed or variable? ...
51
votes
5
answers
56k
views
Plotly notebook mode with google colaboratory
I am am trying out colaboratory with plotly notebook mode - I open a new notebook, copy and paste the following simple example from plotly's documentation, but don't see an output. There is a large ...
51
votes
5
answers
83k
views
How to remove the error "SystemError: initialization of _internal failed without raising an exception"
I am trying to import Top2Vec package for nlp topic modelling. But even after upgrading pip, numpy this error is coming.
I tried
pip install --upgrade pip
pip install --upgrade numpy
I was expecting ...
51
votes
3
answers
72k
views
How to get allocated GPU spec in Google Colab
I'm using Google Colab for deep learning and I'm aware that they randomly allocate GPU's to users. I'd like to be able to see which GPU I've been allocated in any given session. Is there a way to do ...
50
votes
5
answers
50k
views
Can you hide code cell outputs in Google Colab?
Is there a way to hide a single code cell's output in Google Colab?
No one needs to see the sea of pip logs when we install things:
If you look at the screenshot you'll see I tried to apply one of ...
50
votes
8
answers
73k
views
Is it possible to have autocomplete in a notebook in Google Colab?
By autocomplete I mean having something like Intellisense in VS Code by which I can see available functions or members in a particular library?
50
votes
5
answers
204k
views
How can I use GPU on Google Colab after exceeding usage limit?
I'm using Google Colab's free version to run my TensorFlow code. After about 12 hours, it gives an error message
"You cannot currently connect to a GPU due to usage limits in Colab."
I ...
49
votes
4
answers
119k
views
How can I open images in a Google Colaboratory notebook cell from uploaded png files?
I am working with a Google Colaboratory notebook.
I uploaded a file named bp.png into the working directory, and I can see that the file is in there by running !ls in a code cell.
Then I try this ...
48
votes
5
answers
150k
views
When I use Google Colaboratory, how to save image, weights in my Google Drive?
I use Google Colaboratory then I want to save output images in my Google Drive or SSD, HHD but its directory is "/content"
import os
print(os.getcwd())
# "/content"
so is it possible to ...