1

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)'.
juliushibert
  • 404
  • 1
  • 5
  • 14
  • I fixed this by running **`sudo pip2 install PyDrive`** instead of `sudo pip install PyDrive` – Zaz Nov 14 '16 at 23:55

3 Answers3

5

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
  • client_id and client_secret can be obtained from the API Manager of the Google Developers Console after the Google Drive API has been enabled.

  • Set save_credentials_file to an arbitrary location where pydrive can cache the authentication data once it has connected successfully (eg. /etc/duply/pydrive.json or ~/etc/pydrive.json).

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?

  • Thanks @Christian I think the issue is that duply isn't seeing that PyDrive is installed. It's definitely installed through pip. And I've been unable to determine if there's any PATH issues. I believe I have the files setup correctly as I've setup PyDrive with duply on two other machines with no issue. Any ideas why duply might not be seeing the package? – juliushibert Feb 29 '16 at 09:54
  • Are the other machines running OSX, too? And are you using the OSX built-in python? I've run into trouble using it in the past and rely on homebrew for all python needs since. `brew install duplicity` and `pip install PyDrive` (homebrew will install its own pip) should be all you need IIRC. – Christian Mund Feb 29 '16 at 13:04
  • You total genius. It turns out that the issue was being caused by python2-oauth2client 2.00. I downgraded to 1.5.2 like you suggested and duply works as expected. How did you find out this info. Also if you adjust the answer to my question to make this the primary focus of your answer, then I can mark it as completed. Thank you so much!!!! – juliushibert Feb 29 '16 at 22:33
  • Glad I could help. I found this out on a Linux box where I was able to gradually roll back to the last working state, that's how. I have adjusted my answer accordingly. – Christian Mund Mar 01 '16 at 11:59
  • Thank you @ChristianMund – juliushibert Mar 01 '16 at 12:00
0

Same issue for me with python2-oauth2client version 2.00. Solved by downgrading to python2-oauth2client 1.5.2. Works fine with Christian Mund instructions.

  • 1
    This isn't really an answer to the question - you're better off posting it as a comment on Christian's answer. – Joe Clay Mar 03 '16 at 12:22
-1

Duplicity 0.7.10 is a Python 2 script. As you can see:

➜  ~ head $(which duplicity)                                                                                                                                                                                       
#!/usr/bin/env python2                                                                                                                                                                                             
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# duplicity -- Encrypted bandwidth efficient backup
# Version 0.7.10 released August 20, 2016
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.

So make sure to run Python 2 and not Python 3.

Samir Sadek
  • 1,620
  • 1
  • 17
  • 20