Closed anand-bhat closed 2 years ago
To confirm: are you trying to use different google accounts for Colab and connecting to Drive?
This has been supported in the past, but unfortunately no longer is.
I've tried both -- using the same account for Colab and Drive as well as a different ones.
Can I ask you to file feedback in-product? (Help
-> Send feedback
)
Also, another question: does it work if you try from a fresh notebook and use a single account from the get-go?
Can I ask you to file feedback in-product? (
Help
->Send feedback
)
Done.
Also, another question: does it work if you try from a fresh notebook and use a single account from the get-go?
Using drive.mount() worked when using a single account in a new private session! Using a different account for the Drive doesn't work and using _mount() doesn't launch a new window.
I'll create a new browser profile and use a single account to get Drive connected to the notebook. Thanks for the suggestion.!
I'm having an identical issue since this morning, 2022-01-21, too. I'm using Colab Pro + and connecting to my own google drive. Both are of the same account. I was able to trigger the authorization link and auth code, as well as the input box using an additional line of code:
from google.colab import drive, auth, output auth.authenticate_user() drive._mount('/content/drive')
However, this works once, throws an error "ValueError: mount failed: invalid oauth code", and then on rerunning the code fails to load the launch link, window, input box, as described above. I've tried playing around with all possible combination of force_remount, use_metadata_server, and ephemeral boolean arguments.
I had at one point cleared the DNS cache, I've revoked privileges (after running the auth.authenticate_user() and oauth dance, despite the ValueError message, seen them reappear in my console), I've logged out of my google account and restarted browser, none of which provided a solution.
Use this code:
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt-get update -qq 2>&1 > /dev/null !apt-get -y install -qq google-drive-ocamlfuse fuse from google.colab import auth auth.authenticate_user() from oauth2client.client import GoogleCredentials creds = GoogleCredentials.get_application_default() import getpass !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL vcode = getpass.getpass() !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} %cd /content !mkdir drive %cd drive !mkdir MyDrive %cd .. %cd .. !google-drive-ocamlfuse /content/drive/MyDrive
Thanks to @zechenli03
having the same issue since morning, using drive._mount('/drive)
give me the mount failed: invalid oauth code
error before even showing the google auth link.
I have all of my files on my Gsuite account (because it's has a lot more storage), and all my notebooks on my personal account.
Same here, with connecting to the account's own gdrive. Pro+ user.
drive.mount()
Deleting cookies did nothing.
I will check if it is my other Colab tabs logged into another google account (free) that triggers the "anti-free GPU abuse" work you guys got going on.
Update: Incognito Window changed nothing.
@zechenli03's answer reposted by RajdeepBorgohain worked! This after about 8 hours trial and error, thank you! Only item to note, old method of drive.mount() or drive._mount created a 'My Drive' folder ('My\ Drive'), with the solution code removing the space ('MyDrive').
Duping all Drive-related activity into this bug for a general update.
There are 3 main issues:
1) There's a legitimate bug which exposed a set of checkboxes to accept OAuth scopes. That is fixed and being rolled out today. 2) Don't use drive._mount(), it's a non-public API and not guaranteed to do what you expect. 3) We've rolled out a new, more secure method to mount Google Drive. This requires using the same account to mount Google Drive as you use for notebook code execution.
If you can reproduce a Drive mount issue after doing the following, please send feedback:
To confirm: are you trying to use different google accounts for Colab and connecting to Drive?
This has been supported in the past, but unfortunately no longer is.
Why did they remove this :\
@zechenli03's answer reposted by RajdeepBorgohain worked! This after about 8 hours trial and error, thank you! Only item to note, old method of drive.mount() or drive._mount created a 'My Drive' folder ('My\ Drive'), with the solution code removing the space ('MyDrive').
I cant access my shared drives using this. Can you please help? @RajdeepBorgohain @GHBTM
My drive, I do not believe it was shared, so I cannot confirm this will work, but this was RajdeepBorgohain' solution that worked for me. @reachrishav have you tried:
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt-get update -qq 2>&1 > /dev/null !apt-get -y install -qq google-drive-ocamlfuse fuse from google.colab import auth auth.authenticate_user() from oauth2client.client import GoogleCredentials creds = GoogleCredentials.get_application_default() import getpass !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL vcode = getpass.getpass() !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} %cd /content !mkdir drive %cd drive !mkdir MyDrive %cd .. %cd .. !google-drive-ocamlfuse /content/drive/MyDrive
@GHBTM @RajdeepBorgohain Mounting MyDrive seems to work fine. But I am having troubles accessing my shared drives(aka team drives) Is there a similar method to mount the same?
My drive, I do not believe it was shared, so I cannot confirm this will work, but this was RajdeepBorgohain' solution that worked for me. @reachrishav have you tried:
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt-get update -qq 2>&1 > /dev/null !apt-get -y install -qq google-drive-ocamlfuse fuse from google.colab import auth auth.authenticate_user() from oauth2client.client import GoogleCredentials creds = GoogleCredentials.get_application_default() import getpass !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL vcode = getpass.getpass() !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} %cd /content !mkdir drive %cd drive !mkdir MyDrive %cd .. %cd .. !google-drive-ocamlfuse /content/drive/MyDrive
I think this workaround no longer works starting today...
My drive, I do not believe it was shared, so I cannot confirm this will work, but this was RajdeepBorgohain' solution that worked for me. @reachrishav have you tried: !apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt-get update -qq 2>&1 > /dev/null !apt-get -y install -qq google-drive-ocamlfuse fuse from google.colab import auth auth.authenticate_user() from oauth2client.client import GoogleCredentials creds = GoogleCredentials.get_application_default() import getpass !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL vcode = getpass.getpass() !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} %cd /content !mkdir drive %cd drive !mkdir MyDrive %cd .. %cd .. !google-drive-ocamlfuse /content/drive/MyDrive
I think this workaround no longer works starting today...
Is there a new method to mount gdrive?
Describe the current behavior Starting 2022-01-21 (this morning), I've been unable to connect Google Drive to a Colab notebook. Using
drive._mount()
does not launch a new window for authorising access causingValueError: mount failed: invalid oauth code
. This was working previously.Using
drive.mount()
does pop up a window however the auth token doesn't appear to be propagated to Colab resulting inMessageError: Error: credential propagation was unsuccessful
Describe the expected behavior Should be able to connect to Google Drive from Colab.
What web browser you are using Chrome Version 97.0.4692.99 (Official Build) (64-bit) - All extensions disabled (except a password manager).
Additional context Link to a minimal, public, self-contained notebook that reproduces this issue.