pythonduplicity

Pydrive backend not working with duplicicty -- python


I'm trying to use duply / duplicity with the PyDrive. However I keep getting a very cryptic error message telling me to refer to the PyDrive installation manpage. Which offers no solution.

Here's the output of the duply command I'm running including the error.

$ duply mac-mini.gdrive status
Start duply v1.11.1, time is 2016-02-20 19:28:59.
Using profile '/etc/duply/mac-mini.gdrive'.
Using installed duplicity version 0.7.06, python 2.7.10, gpg 1.4.19 (Home: ~/.gnupg), awk 'awk version 20070501', grep 'grep (BSD grep) 2.5.1-FreeBSD', bash '4.3.42(1)-release (x86_64-apple-darwin14.5.0)'.
Checking TEMP_DIR '/tmp' is a folder and writable (OK)
Test - En/Decryption skipped. (GPG disabled)

--- Start running command STATUS at 19:29:00.000 ---
BackendException: PyDrive backend requires PyDrive installationPlease read the manpage to fix.
19:29:00.000 Task 'STATUS' failed with exit code '23'.
--- Finished state FAILED 'code 23' at 19:29:00.000 - Runtime 00:00:00.000 ---

I'm running OS X 10.11.3, have brew and pip installed. I've used pip to install pydrive.

$ pip install pyDrive
Requirement already satisfied (use --upgrade to upgrade): pyDrive in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): google-api-python-client>=1.2 in /Library/Python/2.7/site-packages (from pyDrive)
Requirement already satisfied (use --upgrade to upgrade): PyYAML>=3.0 in /Library/Python/2.7/site-packages (from pyDrive)
Requirement already satisfied (use --upgrade to upgrade): six<2,>=1.6.1 in /Library/Python/2.7/site-packages (from google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): oauth2client<3,>=2.0.0 in /Library/Python/2.7/site-packages (from google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): httplib2<1,>=0.8 in /Library/Python/2.7/site-packages (from google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): uritemplate<1,>=0.6 in /Library/Python/2.7/site-packages (from google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /Library/Python/2.7/site-packages (from oauth2client<3,>=2.0.0->google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules>=0.0.5 in /Library/Python/2.7/site-packages (from oauth2client<3,>=2.0.0->google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): rsa>=3.1.4 in /Library/Python/2.7/site-packages (from oauth2client<3,>=2.0.0->google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.5.0 in /Library/Python/2.7/site-packages (from uritemplate<1,>=0.6->google-api-python-client>=1.2->pyDrive)

And for referenece I'm running current versions of both duplicity and duply.

$ duply -V
  duply version 1.11.1
  (http://duply.net)

  Using installed duplicity version 0.7.06, python 2.7.10, gpg 1.4.19 (Home: ~/.gnupg), awk 'awk version 20070501', grep 'grep (BSD grep) 2.5.1-FreeBSD', bash '4.3.42(1)-release (x86_64-apple-darwin14.5.0)'.

Solution

  • Update 2016/04/25:

    The incompatibility with python2-oauth2client 2.00 has been fixed as of duplicity 0.7.07.1 (see changelog). I just tested it on a Linux box and it works perfectly fine.

    Original post follows:

    First thing, check your python2-oauth2client version. As of writing this version 2.00 doesn't seem to work with duplicity yet. I had to downgrade back to 1.5.2 to make it work again.

    Second, make sure there is no conflict caused by different python versions (OSX built-in vs. homebrew packages vs. manually installed vs. pip etc.). It might be a good idea to use homebrew exclusively.

    Third, make sure your pydrive configuration is complete. Here's a quick rundown on how to do it with a "normal" Google user account:

    Step 1: Create a pydrive backend configuration file

    Create a pydrive configuration file somewhere (eg. /etc/duply/pydrive.conf or ~/etc/pydrive.conf) with the following contents:

    client_config_backend: settings
    client_config:
        client_id: <client-id-string>.apps.googleusercontent.com
        client_secret: <client-secret-string>
    save_credentials: True
    save_credentials_backend: file
    save_credentials_file: </path/to/save/authdata.json>
    get_refresh_token: True
    

    Step 2: Tell duplicity where to find it

    This is done by setting the GOOGLE_DRIVE_SETTINGS shell variable:

    $ export GOOGLE_DRIVE_SETTINGS=/etc/duply/pydrive.conf
    

    You might want to add this to your ~/.bashrc so that all shell sessions have it set automatically.

    Step 3: Authenticate for the first time

    As quoted from the duplicity manpage:

    During the first run, you will be prompted to visit an URL in your browser to grant access to your drive. Once granted, you will receive a verification code to paste back into Duplicity. The credentials are then cached in the file references above for future use.

    ... and you're done.

    Troubleshooting

    If this still doesn't work, check file permissions: Has the user running duplicity sufficient permission for the config files specified above?