Search code examples
python-3.xpipubuntu-16.04pydrive

cannot import name 'CredentialsFileSymbolicLinkError'


I install pydrive using pip3 with --user. When trying to run an example script, I get the following error:

$ python3 quick.py 
Traceback (most recent call last):
  File "quick.py", line 1, in <module>
    from pydrive.drive import GoogleAuth
  File "/home/fauzan/.local/lib/python3.5/site-packages/pydrive/drive.py", line 2, in <module>
    from .files import GoogleDriveFile
  File "/home/fauzan/.local/lib/python3.5/site-packages/pydrive/files.py", line 12, in <module>
    from .auth import LoadAuth
  File "/home/fauzan/.local/lib/python3.5/site-packages/pydrive/auth.py", line 15, in <module>
    from oauth2client.file import CredentialsFileSymbolicLinkError
ImportError: cannot import name 'CredentialsFileSymbolicLinkError'

What I tried doing was manually editing oauth2client's file.py and adding the missing exception from the github repo (line 32). However, then I encountered an Import error, that there is no module named oauth2client.util. Pydrive's auth.py imports scopes_to_string from oauth2client.util. I checked the oauth2client package folder, and util.py was not present.

I then uninstalled pydrive, oauth2client and google-api-python-client using pip and pip3. Then I installed pydrive agian, this time also with --no-cache-dir. Again the CredentialFile... error was thrown. I don't know how to proceed further.

I don't want to spend days figuring how to go about installing packages, that time be better spend writing code. :(

What I observed that the github repo differed quite a bit from the package files on my system.

Edit: There seem to be two oauth2client packages this and this

Edit: This is bug and is being tracked


Solution

  • If you're experiencing this issue pydrive needs to be updated to a version >= 1.3.1. Using pip from a command prompt:

    pip install pydrive --upgrade
    

    Just submitting this as an answer so that we can mark this as solved/answered.