I cannot access any github repository in google colabs - google-colaboratory

I am trying to import a notebook from a github repository with the following github url: https://github.com/hse-aml/intro-to-dl but after hitting enter for search, the output is no result. There is similar behavior of no output if I search for anything else. There is also no difference in output when I include private repos. What can I do to fix this problem?

Related

Google Colab - Not able to import API key file

I have a code in Google Colab which uses a Python package called Atlite, which in turn retrieves data from the Climate Data Store (CDS) through the use of an API key.
When running this code in Python I just need to have the file containing the key saved in a specific folder and then the code runs perfectly fine.
When I try to run the code in Google Colab the following error arises:
**Exception: Missing/incomplete configuration file: /root/.cdsapirc
**
I have the file ".cdsapirc" in my computer but when I try to import it to the "/root" folder in Google Colab it just does not get imported. I can import a .py file, but when I try to import the ".cdsapirc" file (which is basically a txt file) it does not work.
Could someone please help me to solve this issue?
Thank you!
Regards,
Sebastian
If uploading the .cdsapirc file doesn't work, you could try creating it inside Google Colab using a simple Python script:
uid = "<your uid>"
apikey = "<your api-key"
with open("/root/.cdsapirc", "w") as f:
print("url: https://cds.climate.copernicus.eu/api/v2", file=f)
print(f"key: {uid}:{apikey}", file=f)
You can get the uid and apikey either from CDS after logging in or you open you local .cdsapirc file and look them up there, see here for more information.
There might be a nicer solution by someone more familiar with Google Colab though.

What is https://storage.googleapis.com and how do I use and explore it?

I've been seeing such snippets in a lot of notebooks of tensorflow tutorials
!wget --no-check-certificate \
https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \
-O /tmp/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5
I understand we're downloading a pretrained model here and in other cases we can download datasets
Now I want to explore what else I can download, for example I wanted to download caltech256 dataset like this, but I don't know if that is even an option because if you go to googleapis.com, you get error 404, besides I cant find any resources explaining what it is and how to use it .
So how do I explore it, all the efforts are appreciated
If you are facing 404 error, it means those files has got restricted access or files has been removed by author from google cloud. To explore various public Datasets /pre-trained solutions .
Visit
https://cloud.google.com/solutions/datasets
Reference
Google Cloud Function throwing a 404 error

bug (resolved) with "Mount drive" web-button in colab. Accessing "shared with me" files from google colab (y2020, previous solutions seem to fail)

[ Newer Edit]: colab team reported that they corrected the issue on May 27 2020.
I have checked - it works Okay for me now.
Link to issue: https://github.com/googlecolab/colabtools/issues/1205
==================================================================
[New Edit:] It became clear that problem below arises ONLY if mount the google drive to colab by via web interface button "Mount Drive"
and does NOT appear if mount by command line way.
So seems web way is bugged. See details in my own answer below.
It is checked for "Chrome" browser.
==================================================================
[Original question:]
How to access "shared with me" from google colab ? (Interface seems changed now (2020) and previously described solutions does not seem to work).
More details:
The question has been asked several times, and
the solutions described e.g. here : https://stackoverflow.com/a/53887376/625396
The problem that I do not see "Add to My Drive" , but see "Add shortcut to Drive".
After doing it, we can see that via web-interface for google drive, that shortcut indeed appears.
BUT that shortcut canNOT be seen via colab utilities, like
os.listdir() !
So shortcut seems to be invisible for colab, and not clear how to access it.
Below are the screenshot, showing that colab does not see the shortcut to "shared with me"-"cytotrace_datasets", but web-gui of google drive can see.
Here is screenshot what I see by colab (shortcut canNOT be seen):
Here is screenshot what I see by web-gui of google drive (shortcut can be seen):
Brief: do NOT mount google drive by web-interface button "Mount drive" (it is bugged), but do it in the "old" command line way, and you will not have problems.
Details:
After getting excellent answer above and playing with it,
it seems I found some strange thing which results in simpler solution and probably indicates that there is currently a bug with mounting the google drive by the web interface button "Mount drive".
I mean do NOT mount the drive by interface:
But do it in the old way:
and that is all - you will get the access to files which added before with the help of
"Add shortcut to Drive":
Suppose you want to read a shared csv file from drive. You have done "Add shortcut to Drive".
1) At Colab Notebook Connect to your drive.
# Import PyDrive and associated libraries.
# This only needs to be done once per notebook.
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
# This only needs to be done once per notebook.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
2) Get the id of shared file you want to access.
Open file
-> go to linksharing [https://drive.google.com/open?id=1JKECh3GNry6xbAK6aBSzQtSntD4GTEl ] -> copy the the string after 'id='
3) back to colab
# A file ID looks like: laggVyWshwcyP6kEI-y_W3P8D26sz
file_id = '1JKECh3GNry6xbAK6aBSzQtSntMD4GTEl'
downloaded = drive.CreateFile({'id': file_id}) #important
print(downloaded['title']) # it should print the title of desired file
downloaded.GetContentFile('file.csv')
#Finally, you can read the file as pandas dataframe.
import pandas as pd
df= pd.read_csv('file.csv')
Note : This is my first ever answer to a stack overflow question

Not able to add implementation 'com.google.android.libraries.places:places:2.2.0'

I am trying to add Places SDK for android.
I am following the following documentation
https://developers.google.com/places/android-sdk/start and
https://developers.google.com/places/android-sdk/client-migration
Unfortunately i am not able to add dependency "implementation 'com.google.android.libraries.places:places:2.2.0'"
I have gone through following links. But no use. Please help me with this.
Failed to resolve: com.google.android.libraries.places:1.0.0:
Google's new Places Library ( implementation 'com.google.android.libraries.places:1.0.0') not resolving
Finally i found solution to my issue.
I solved it by installing the compatibility library.
Followed this. https://developers.google.com/places/android-sdk/client-migration
Following two steps resolved my issue.
Copy the contents of places_compat_compatify.sh, and save as a file to your local computer.
Use the following command to run the compatibility script
./places_compat_compatify.sh 2.1.0
After this, I could run my project successfully and could Place API.
Thanks

How to integrate Crashlytics with Github?

Did anyone have any success integrating crashlytics with github, I'm not really sure how relevant this question would be here?
I have android app already on github, and I have crashltyics correctly integrated in the app, but I tried to link it to the github repository and I'm always gettings, couldn't access repository (I contacted them so many time but they never replied) I'm 100% sure I generated the token as described (as I already did this for other apps) but Crashlytics is always rejecting this github token.
did anyone have success integrating it?
The error I'm getting is as follows:
Could not access repository for https://github.com/User/Repository
I followed the steps as per this link:
https://help.github.com/articles/creating-an-access-token-for-command-line-use
I also tried to do this with one of my open-source libs
https://github.com/shehabic/closeby
but it didn't work either, I'm not sure if it's me or crashlytics Github integration is not working
Ok, I finally got a reply from them and found out how to do it:
Simply when entering the repository in the corresponding field enter is as follows:
user/repo
instead of
http://github.com/user/repo
the integration is not really that powerful, it just creates an issue with just 1 line, without any referral to the code repo in github
I was also facing same problem but i fixed it as follows,
Step1 : Your GitHub repository: Company Name>/Repository Name
e.g cmpanyXYZ/abcd
(Note : 1. do not use .git at end of repository name. 2. You can find this details in repository clone url)
Step 2 : Generate access token from here
Copy generated token in step2 box from image.
Now Click on Verify button
Go to Firebase -> Crashlytics.
Follow the documentation step by step.
There is also a script demonstrating how to force crash and test the app.
Make sure you give the correct path of Google Info pList file in
the AppDelegate.