I've spent a few hours trying to configure Duplicity to perform automated remote backups to a Google Drive. At this point, it's safe to say that I'm in my own private dependency hell.

Using the version of Duplicity that came with my distribution (0.6.x), I was getting an error:

BackendException: Google Docs backend requires Google Data APIs Python Client Library (see http://code.google.com/p/gdata-python-client/).

despite the fact that I had the Google API Python Client installed. So, I decided to try and upgrade duplicity, which failed with:

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c duplicity/_librsyncmodule.c -o build/temp.linux-x86_64-2.7/duplicity/_librsyncmodule.o
duplicity/_librsyncmodule.c:26:22: fatal error: librsync.h: No such file or directory
 #include <librsync.h>
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

So, I decided to try and upgrade librsync as well, to the latest stable version (2.0). After struggling with dependencies for that, I finally got both librsync and duplicity updated to their latest stable versions.

So, when I went to give my upgraded version of Duplicity a spin using duplicity --version, I now get this error immediately:

Traceback (most recent call last):
  File "/usr/local/bin/duplicity", line 71, in <module>
    from duplicity import collections
  File "/usr/local/lib/python2.7/dist-packages/duplicity/collections.py", line 32, in <module>
    from duplicity import path
  File "/usr/local/lib/python2.7/dist-packages/duplicity/path.py", line 43, in <module>
    from duplicity import librsync
  File "/usr/local/lib/python2.7/dist-packages/duplicity/librsync.py", line 30, in <module>
    from . import _librsync
ImportError: librsync.so.2: cannot open shared object file: No such file or directory

To get librsync.h then

sudo apt-get install python-dev  
sudo apt-get install librsync-dev  

work for me.


I was able to solve this by adding the path for the shared object librsync.so.2 to LD_LIBRARY_PATH. In Ubuntu, this has to be done using ldconfig:

sudo nano /etc/ld.so.conf.d/librsync.so.2.conf



You must now reload Ubuntu's ldconfig cache:

sudo ldconfig


Both pl.smith's and alexw's answers are correct here, but in combination. I received an identical error attempting to upgrade from duplicity 0.7.6 to 0.7.14 using pip on Ubuntu 16.04 LTS. Here's what I did to fix them:

  1. Install the necessary librsync header files (these are not installed by default):

    sudo apt update
    sudo apt install librsync-dev
  2. Create a config file for librsync libraries in your ld cache directory (skip this step if the file already exists):

    sudo touch /etc/ld.so.conf.d/librsync.so.2.conf
  3. Add the directory containing the librsync header files to the LD_LIBRARY_PATH environment variable:

    sudo <your favorite text editor> /etc/ld.so.conf.d/librsync.so.2.conf

    Add /usr/local/lib to a line in this file.

  4. Refresh the ldconfig cache:

    sudo ldconfig

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.