google-colaboratory

Python basemap in google colaboratory

十年热恋 提交于 2019-12-01 18:09:15
I used to use the following commands to install libgeos and basemap in google colaboratory and it worked perfectly until last week. !apt-get -qq install libgeos-dev !pip install -qq https://github.com/matplotlib/basemap/archive/master.zip from mpl_toolkits.basemap import Basemap, cm The error shows --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-3-f27b0fbc3a52> in <module>() ----> 1 from mpl_toolkits.basemap import Basemap, cm 2 from matplotlib.patches import Polygon /usr/local/lib/python3.6/dist

Test if notebook is running on Google Colab

不羁岁月 提交于 2019-12-01 16:22:39
问题 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. 回答1: Try importing google.colab try: import google.colab IN_COLAB = True except: IN_COLAB = False Or just check if it's in sys.modules import sys IN_COLAB = 'google.colab' in sys.modules 回答2: In a %%bash cell, use: %%bash [[ ! -e /colabtools ]] && exit # Continue only if running on Google Colab # Do Colab-only stuff here Or in

Google Colaboratory ServiceWorker Error On Chrome

女生的网名这么多〃 提交于 2019-12-01 14:43:27
问题 Whenever I open a Colaboratory Document I always get the same error message: NotSupportedError: Failed to register a ServiceWorker: The user denied permission to use Service Worker. This is happening on chrome and my browser allows for ServiceWorkers ( chrome://serviceworker-internals/ ), what's going on? Because the thing is all the code still runs. 回答1: Colab's output frames use service workers to support some functionality such as displaying richer graphs (Altair and Plot.ly). The error

Is it possible to install cupy on google colab?

社会主义新天地 提交于 2019-12-01 06:39:48
I am trying to run chainer with GPU on google colab. This requires cupy installed however I fail to install this properly as it cannot find the cuda environment in my colab vm. Error message as follows... Collecting cupy Downloading cupy-2.4.0.tar.gz (1.7MB) 100% |████████████████████████████████| 1.7MB 740kB/s Complete output from command python setup.py egg_info: cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ /tmp/tmpds3ikncy/a.cpp:1:10: fatal error: cublas_v2.h: No such file or directory #include ^~~~~~~~~~~~~ compilation terminated. Options:

Is it possible to set environment variables in Google's Colaboratory?

非 Y 不嫁゛ 提交于 2019-12-01 05:11:42
I am running some Python scripts in Google's Colaboratory platform. Now, I need to set some environment variables of the system. Like the following shows: !export PATH=drive/app/tf-models-fork/research;drive/app/tf-models-fork/research/object_detection;drive/app/tf-models-fork/research/slim;$PATH I tried to add the location to the variable PATH. However, I am getting the following errors: /bin/sh: 1: drive/app/tf-models-fork/research/object_detection: Permission denied /bin/sh: 1: drive/app/tf-models-fork/research/slim: Permission denied /bin/sh: 1: drive/app/tf-models-fork/research:

Is it possible to install cupy on google colab?

无人久伴 提交于 2019-12-01 04:24:29
问题 I am trying to run chainer with GPU on google colab. This requires cupy installed however I fail to install this properly as it cannot find the cuda environment in my colab vm. Error message as follows... Collecting cupy Downloading cupy-2.4.0.tar.gz (1.7MB) 100% |████████████████████████████████| 1.7MB 740kB/s Complete output from command python setup.py egg_info: cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ /tmp/tmpds3ikncy/a.cpp:1:10:

Link to images within google drive from a colab notebook

六眼飞鱼酱① 提交于 2019-12-01 04:20:15
问题 I would like to store image files on a drive and link to them from a collaboration notebook. Is this possible? For example. google-drive/ notebook.ipynb images/ pic.jpg Within notebook.ipynb markdown cell: ![Alternate Text](images/pic.jpg) 回答1: A possible alternative to the great answer by Arpit Gupta for images are publicly shared: Get the ID of your file and prepend this line: https://docs.google.com/uc?export=download&id= Grabbed it from this forum post. 回答2: Use the following code: !apt

Adding dataset files on the google colaboratory

浪尽此生 提交于 2019-12-01 03:38:24
问题 I am trying to upload cifar data-set to google colabratory. i consists of 'batches.meta','data_batch_1','data_batch_2','data_batch_3','data_batch_4','data_batch_5','test_batch' I would like to add upload multiple files and add them to the same place to act on them 回答1: you could upload somewhere, after that you can download from code cell notebooks and use this shell command: wget for ex: !wget http://your_domain/your_file.zip note: we use '!' for running shell command in a notebook. 来源:

Is it possible to set environment variables in Google's Colaboratory?

白昼怎懂夜的黑 提交于 2019-12-01 02:48:03
问题 I am running some Python scripts in Google's Colaboratory platform. Now, I need to set some environment variables of the system. Like the following shows: !export PATH=drive/app/tf-models-fork/research;drive/app/tf-models-fork/research/object_detection;drive/app/tf-models-fork/research/slim;$PATH I tried to add the location to the variable PATH. However, I am getting the following errors: /bin/sh: 1: drive/app/tf-models-fork/research/object_detection: Permission denied /bin/sh: 1: drive/app

How to use cap = cv2.VideoCapture(0) in Google Colab

橙三吉。 提交于 2019-12-01 02:38:30
cap = cv2.VideoCapture(0) is not opening web camera when executing the command in Google Colab. Since Colab is running in your browser, you'll want to use web APIs to access local hardware like a camera. Here's an example showing how to capture an image from your local webcam in Colab: https://colab.research.google.com/notebooks/snippets/advanced_outputs.ipynb#scrollTo=2viqYx97hPMi 来源: https://stackoverflow.com/questions/54389727/how-to-use-cap-cv2-videocapture0-in-google-colab