cannot import name Gio

Asked by Dan Jaenecke on 2018-02-16

Hi,

I am using duplicity via deja-dup to create backups; but recently it stopped working, stating "BackendException: Hintergrundprogramm konnte nicht initialisiert werden: cannot import name Gio" (sorry for the german error messages, unfortunately I failed to switch to english messages).

The command causing this error (reduced to the minimum):

$ duplicity --gio collection-status file:///tmp

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1532, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1526, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1364, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python2.7/dist-packages/duplicity/commandline.py", line 1108, in ProcessCommandLine
    globals.backend = backend.get_backend(args[0])
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 223, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 211, in get_backend_object
    raise BackendException(_("Could not initialize backend: %s") % str(sys.exc_info()[1]))
BackendException: Hintergrundprogramm konnte nicht initialisiert werden: cannot import name Gio

Removing --gio from the command fixes the problem, but since the command is created by deja-dup I have no idea how to get rid of that option.

A possible solutions I found was that the package python-gi might be missing; it was already installed, and even a
$ apt install --reinstall python-gi
did not help.

My OS: Ubuntu 16.04.3 LTS
Version of duplicity: 0.7.06

I'd really appreciate any help…

regards
Dan

Question information

Language:
English Edit question
Status:
Answered
For:
Duplicity Edit question
Assignee:
No assignee Edit question
Last query:
2018-02-18
Last reply:
2018-02-18
Manfred Hampl (m-hampl) said : #1

Try

sudo apt install python-gobject-2
and/or
sudo apt install python-gobject-2-dev

Dan Jaenecke (wonk042) said : #2

Hi,
thanks for the suggestion.
Unfortunately it did not solve my problem. python-gobject-2 was already installed, and adding python-gobject-2-dev did not help.

Manfred Hampl (m-hampl) said : #3

Are there any messages similar to
"Import of ... failed/succeeded"
in the log (before to your error messages)?

Dan Jaenecke (wonk042) said : #4

This is the full output:

duplicity --verbosity=9 --gio collection-status file:///tmp
Achtung: Parameter --gio ist veraltet und wird in einer der nächsten Versionen entfernt.
Bitte verwenden Sie Standarddateinamen.
Folgendes Archivverzeichnis wird benutzt: $HOME/.cache/duplicity/c2731c0788339744944161fd8afb74dd
Folgender Sicherungsname wird benutzt: c2731c0788339744944161fd8afb74dd
Import von duplicity.backends.azurebackend Succeeded
Import von duplicity.backends.b2backend Succeeded
Import von duplicity.backends.botobackend Succeeded
Import von duplicity.backends.cfbackend Succeeded
Import von duplicity.backends.copycombackend Succeeded
Import von duplicity.backends.dpbxbackend Succeeded
Import von duplicity.backends.gdocsbackend Succeeded
Import von duplicity.backends.giobackend Succeeded
Import von duplicity.backends.hsibackend Succeeded
Import von duplicity.backends.hubicbackend Succeeded
Import von duplicity.backends.imapbackend Succeeded
Import von duplicity.backends.lftpbackend Succeeded
Import von duplicity.backends.localbackend Succeeded
Import von duplicity.backends.megabackend Succeeded
Import von duplicity.backends.multibackend Succeeded
Import von duplicity.backends.ncftpbackend Succeeded
Import von duplicity.backends.onedrivebackend Succeeded
Import von duplicity.backends.par2backend Succeeded
Import von duplicity.backends.pydrivebackend Succeeded
Import von duplicity.backends.rsyncbackend Succeeded
Import von duplicity.backends.ssh_paramiko_backend Succeeded
Import von duplicity.backends.ssh_pexpect_backend Succeeded
Import von duplicity.backends.swiftbackend Succeeded
Import von duplicity.backends.sxbackend Succeeded
Import von duplicity.backends.tahoebackend Succeeded
Import von duplicity.backends.webdavbackend Succeeded
Temporäres Verzeichnis /tmp/duplicity-EguFuP-tempdir wird benutzt
Fehlerdetail des Hintergrundprogramms: Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1532, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1526, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1364, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python2.7/dist-packages/duplicity/commandline.py", line 1108, in ProcessCommandLine
    globals.backend = backend.get_backend(args[0])
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 223, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 211, in get_backend_object
    raise BackendException(_("Could not initialize backend: %s") % str(sys.exc_info()[1]))
BackendException: Hintergrundprogramm konnte nicht initialisiert werden: cannot import name Gio

BackendException: Hintergrundprogramm konnte nicht initialisiert werden: cannot import name Gio

Manfred Hampl (m-hampl) said : #5

Strange. At the beginning it tells "Import von duplicity.backends.giobackend Succeeded" and later it got a problem with it.

I am sorry, but I am running out of ideas.

I suggest that you create a bug report.

Dan Jaenecke (wonk042) said : #6

Thanks for your help

edso (ed.so) said : #7

On 2/17/2018 0:02, Dan Jaenecke wrote:
> My OS: Ubuntu 16.04.3 LTS
> Version of duplicity: 0.7.06

hey Dan,

please update to the latest 0.7.16 from tarball or ppa (see http://duplicity.nongnu.org/). it should show more details on import errors.

make sure that deja-dup is run with python 2.7.

..ede/duply.net

Dan Jaenecke (wonk042) said : #8

Hi edso,

same problem with 0.7.16…

$ PYTHONPATH=/opt/duplicity/lib/python2.7/site-packages /opt/duplicity/bin/duplicity -V
duplicity 0.7.16

$ PYTHONPATH=/opt/duplicity/lib/python2.7/site-packages /opt/duplicity/bin/duplicity --verbosity=9 --gio collection-status file:///tmp
Achtung: Parameter --gio ist veraltet und wird in einer der nächsten Versionen entfernt.
Bitte verwenden Sie Standarddateinamen.
Folgendes Archivverzeichnis wird benutzt: /home/daniel/.cache/duplicity/c2731c0788339744944161fd8afb74dd
Folgender Sicherungsname wird benutzt: c2731c0788339744944161fd8afb74dd
GPG binary is gpg, version 1.4.20
Import von duplicity.backends.acdclibackend Succeeded
Import von duplicity.backends.azurebackend Succeeded
Import von duplicity.backends.b2backend Succeeded
Import von duplicity.backends.botobackend Succeeded
Import von duplicity.backends.cfbackend Succeeded
Import von duplicity.backends.dpbxbackend Failed: No module named dropbox
Import von duplicity.backends.gdocsbackend Succeeded
Import von duplicity.backends.giobackend Succeeded
Import von duplicity.backends.hsibackend Succeeded
Import von duplicity.backends.hubicbackend Succeeded
Import von duplicity.backends.imapbackend Succeeded
Import von duplicity.backends.lftpbackend Succeeded
Import von duplicity.backends.localbackend Succeeded
Import von duplicity.backends.mediafirebackend Succeeded
Import von duplicity.backends.megabackend Succeeded
Import von duplicity.backends.multibackend Succeeded
Import von duplicity.backends.ncftpbackend Succeeded
Import von duplicity.backends.onedrivebackend Succeeded
Import von duplicity.backends.par2backend Succeeded
Import von duplicity.backends.pydrivebackend Succeeded
Import von duplicity.backends.rsyncbackend Succeeded
Import von duplicity.backends.ssh_paramiko_backend Succeeded
Import von duplicity.backends.ssh_pexpect_backend Succeeded
Import von duplicity.backends.swiftbackend Succeeded
Import von duplicity.backends.sxbackend Succeeded
Import von duplicity.backends.tahoebackend Succeeded
Import von duplicity.backends.webdavbackend Succeeded
Temporäres Verzeichnis /tmp/duplicity-JQJDoc-tempdir wird benutzt
Fehlerdetail des Hintergrundprogramms: Traceback (innermost last):
  File "/opt/duplicity/bin/duplicity", line 1559, in <module>
    with_tempdir(main)
  File "/opt/duplicity/bin/duplicity", line 1545, in with_tempdir
    fn()
  File "/opt/duplicity/bin/duplicity", line 1381, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/opt/duplicity/lib/python2.7/site-packages/duplicity/commandline.py", line 1132, in ProcessCommandLine
    globals.backend = backend.get_backend(args[0])
  File "/opt/duplicity/lib/python2.7/site-packages/duplicity/backend.py", line 223, in get_backend
    obj = get_backend_object(url_string)
  File "/opt/duplicity/lib/python2.7/site-packages/duplicity/backend.py", line 211, in get_backend_object
    raise BackendException(_("Could not initialize backend: %s") % str(sys.exc_info()[1]))
 BackendException: Hintergrundprogramm konnte nicht initialisiert werden: cannot import name Gio

BackendException: Hintergrundprogramm konnte nicht initialisiert werden: cannot import name Gio

edso (ed.so) said : #9

Dan,

can you check if the gio files
  https://packages.ubuntu.com/xenial/amd64/python-gi/filelist
exist on your box?

would you be willing to patch your duplicity to have it describe the error in more detail?

..ede/duply.net

On 2/18/2018 12:33, Dan Jaenecke wrote:
> Question #664503 on Duplicity changed:
> https://answers.launchpad.net/duplicity/+question/664503
>
> Status: Answered => Open
>
> Dan Jaenecke is still having a problem:
> Hi edso,
>
> same problem with 0.7.16…
>
> $ PYTHONPATH=/opt/duplicity/lib/python2.7/site-packages /opt/duplicity/bin/duplicity -V
> duplicity 0.7.16
>
> $ PYTHONPATH=/opt/duplicity/lib/python2.7/site-packages /opt/duplicity/bin/duplicity --verbosity=9 --gio collection-status file:///tmp
> Achtung: Parameter --gio ist veraltet und wird in einer der nächsten Versionen entfernt.
> Bitte verwenden Sie Standarddateinamen.
> Folgendes Archivverzeichnis wird benutzt: /home/daniel/.cache/duplicity/c2731c0788339744944161fd8afb74dd
> Folgender Sicherungsname wird benutzt: c2731c0788339744944161fd8afb74dd
> GPG binary is gpg, version 1.4.20
> Import von duplicity.backends.acdclibackend Succeeded
> Import von duplicity.backends.azurebackend Succeeded
> Import von duplicity.backends.b2backend Succeeded
> Import von duplicity.backends.botobackend Succeeded
> Import von duplicity.backends.cfbackend Succeeded
> Import von duplicity.backends.dpbxbackend Failed: No module named dropbox
> Import von duplicity.backends.gdocsbackend Succeeded
> Import von duplicity.backends.giobackend Succeeded
> Import von duplicity.backends.hsibackend Succeeded
> Import von duplicity.backends.hubicbackend Succeeded
> Import von duplicity.backends.imapbackend Succeeded
> Import von duplicity.backends.lftpbackend Succeeded
> Import von duplicity.backends.localbackend Succeeded
> Import von duplicity.backends.mediafirebackend Succeeded
> Import von duplicity.backends.megabackend Succeeded
> Import von duplicity.backends.multibackend Succeeded
> Import von duplicity.backends.ncftpbackend Succeeded
> Import von duplicity.backends.onedrivebackend Succeeded
> Import von duplicity.backends.par2backend Succeeded
> Import von duplicity.backends.pydrivebackend Succeeded
> Import von duplicity.backends.rsyncbackend Succeeded
> Import von duplicity.backends.ssh_paramiko_backend Succeeded
> Import von duplicity.backends.ssh_pexpect_backend Succeeded
> Import von duplicity.backends.swiftbackend Succeeded
> Import von duplicity.backends.sxbackend Succeeded
> Import von duplicity.backends.tahoebackend Succeeded
> Import von duplicity.backends.webdavbackend Succeeded
> Temporäres Verzeichnis /tmp/duplicity-JQJDoc-tempdir wird benutzt
> Fehlerdetail des Hintergrundprogramms: Traceback (innermost last):
> File "/opt/duplicity/bin/duplicity", line 1559, in <module>
> with_tempdir(main)
> File "/opt/duplicity/bin/duplicity", line 1545, in with_tempdir
> fn()
> File "/opt/duplicity/bin/duplicity", line 1381, in main
> action = commandline.ProcessCommandLine(sys.argv[1:])
> File "/opt/duplicity/lib/python2.7/site-packages/duplicity/commandline.py", line 1132, in ProcessCommandLine
> globals.backend = backend.get_backend(args[0])
> File "/opt/duplicity/lib/python2.7/site-packages/duplicity/backend.py", line 223, in get_backend
> obj = get_backend_object(url_string)
> File "/opt/duplicity/lib/python2.7/site-packages/duplicity/backend.py", line 211, in get_backend_object
> raise BackendException(_("Could not initialize backend: %s") % str(sys.exc_info()[1]))
> BackendException: Hintergrundprogramm konnte nicht initialisiert werden: cannot import name Gio
>
> BackendException: Hintergrundprogramm konnte nicht initialisiert werden:
> cannot import name Gio
>

Manfred Hampl (m-hampl) said : #10

What is the output of the commands

sudo updatedb
locate Gio.py
locate gio.x86_64-linux-gnu.so
locate gio.i386-linux-gnu.so

edso (ed.so) said : #11

On 2/18/2018 12:33, Dan Jaenecke wrote:
> $ PYTHONPATH=/opt/duplicity/lib/python2.7/site-packages /opt/duplicity/bin/duplicity -V
> duplicity 0.7.16
>
> $ PYTHONPATH=/opt/duplicity/lib/python2.7/site-packages /opt/duplicity/bin/duplicity --verbosity=9 --gio collection-status file:///tmp

i see you are running duplicity in shell. in case you are willing to waive the comfort of deja-dup (which insists on gio) you could use the standard backends. note the additional given default python libs path and the missing '--gio'

  PYTHONPATH=/opt/duplicity/lib/python2.7/site-packages:/usr/lib/python2.7/dist-packages/ /opt/duplicity/bin/duplicity --verbosity=9 --gio collection-status file:///tmp

..ede/duply.net

Dan Jaenecke (wonk042) said : #12

Hi edso and Manfred,

thanks for trying to help…

@edso:
all files from https://packages.ubuntu.com/xenial/amd64/python-gi/filelist exist.

Yes, I could path duplicity, but I most warn you that I am not really into python ;)
And yes, I *could* stop using deja-dup, but it is really convenient and I'd prefer to continue using it. For the moment I fixed the problem by having a shell-wrapper for duplicity which discards the --gio-Parameter.

@ Manfred
$ sudo updatedb
<no output>

$ locate Gio.py
/usr/lib/python2.7/dist-packages/gi/overrides/Gio.py
/usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyc
/usr/lib/python3/dist-packages/gi/overrides/Gio.py
$ locate gio.x86_64-linux-gnu.so
/usr/lib/python2.7/dist-packages/gtk-2.0/gio/_gio.x86_64-linux-gnu.so
$ locate gio.i386-linux-gnu.so
<no output>

edso (ed.so) said : #13

On 2/18/2018 13:12, Dan Jaenecke wrote:
> And yes, I *could* stop using deja-dup, but it is really convenient and I'd prefer to continue using it. For the moment I fixed the problem by having a shell-wrapper for duplicity which discards the --gio-Parameter.

nifty trick ;).. and oh so easy! so are you satisfied by your workaround or are you willing to dig deeper into why gio fails?

..ede/duply.net

If you do:

$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import Gio
>>> ^D

You should see no errors. If so, what do you get?

...Ken

On Sun, Feb 18, 2018 at 6:12 AM, Dan Jaenecke <
<email address hidden>> wrote:

> Question #664503 on Duplicity changed:
> https://answers.launchpad.net/duplicity/+question/664503
>
> Status: Answered => Open
>
> Dan Jaenecke is still having a problem:
> Hi edso and Manfred,
>
> thanks for trying to help…
>
> @edso:
> all files from https://packages.ubuntu.com/xenial/amd64/python-gi/filelist
> exist.
>
> Yes, I could path duplicity, but I most warn you that I am not really into
> python ;)
> And yes, I *could* stop using deja-dup, but it is really convenient and
> I'd prefer to continue using it. For the moment I fixed the problem by
> having a shell-wrapper for duplicity which discards the --gio-Parameter.
>
> @ Manfred
> $ sudo updatedb
> <no output>
>
> $ locate Gio.py
> /usr/lib/python2.7/dist-packages/gi/overrides/Gio.py
> /usr/lib/python2.7/dist-packages/gi/overrides/Gio.pyc
> /usr/lib/python3/dist-packages/gi/overrides/Gio.py
> $ locate gio.x86_64-linux-gnu.so
> /usr/lib/python2.7/dist-packages/gtk-2.0/gio/_gio.x86_64-linux-gnu.so
> $ locate gio.i386-linux-gnu.so
> <no output>
>
> --
> You received this question notification because your team duplicity-team
> is an answer contact for Duplicity.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~duplicity-team
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~duplicity-team
> More help : https://help.launchpad.net/ListHelp
>

Can you help with this problem?

Provide an answer of your own, or ask Dan Jaenecke for more information if necessary.

To post a message you must log in.