duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #05424
[Question #690023]: in <module>from duplicity.dup_main import mainModuleNotFoundError: No module named 'duplicity'.
New question #690023 on Duplicity:
https://answers.launchpad.net/duplicity/+question/690023
Hey! It's my first time here and I'm not sure if I'm using the
system correctly.
TL;DR:
Duplicity didn't work after OS reinstall, probably due to a botched
python installation.
First an error showed during a backup, blocking it:
Attempt 1 failed. TypeError: can only concatenate str (not "bytes") to
strAttempt 1 failed. TypeError: can only concatenate str (not "bytes")
to str
After reinstalling from source there was another error. I reinstalled
from a snap and got the same error, which stopped even running
`duplicity --version`:
in <module>from duplicity.dup_main import mainModuleNotFoundError: No
module named 'duplicity'
After reinstalling latest version of pip and trying to install
duplicity from pip and being told that pip already installed it, I
copied files like this:
`cp -rp /usr/local/lib/python2.7/dist-packages/duplicity \
/usr/local/lib/python3.7/dist-packages/`
which solved the problem.
Thanks for your work on duplicity!
Long version:
Had issues using duplicity after a reinstall and moving from Ubuntu
Mate 18.04 to 19.10. (Used program called Aptik to assist with moving,
and it might have caused some chaos while reinstalling old
packages. It could've also been me using python/pip in an unskilled
way to install either b2 duplicity addon or some other software.)
First there was this error:
Attempt 1 failed. TypeError: can only concatenate str (not "bytes") to
strAttempt 1 failed. TypeError: can only concatenate str (not "bytes")
to str
duckduckgoing for answer led to this thread:
https://bugs.archlinux.org/task/65239
Here I got the idea to try running a more up-to-date version of
duplicity in hope that the bugs were fixed in the latest version.
I downloaded the source code and thanks to a really good documentation
managed to build and install the newer duplicity. However here came
another problem. When trying to run duplicity, even just duplicity
--version, there was another error:
in <module>from duplicity.dup_main import mainModuleNotFoundError: No
module named 'duplicity'
As I had no idea what import is or what module is, I started looking
in the source catalog and saw a catalog named 'snap'. Here I got the
idea to install duplicity as a snap package as it was something I'm
familiar with. When trying to run the snap package, got the same
error:
in <module>from duplicity.dup_main import mainModuleNotFoundError: No
module named 'duplicity'
After purging python pip that was installed by the system and
installing it from pip website, tried installing duplicity packages
trough pip. Pip reported, that Requirement already satisfied:
duplicity in /usr/local/lib/python2.7/dist-packages. And it was
there, but still didn't work. Then I educated myself as to what python
words 'import' and 'module' mean. That + reading the main duplicity
source file (where the problem occurred) made me wonder why
pip/duplicity installs into python 2.7 directory and not in python
3.7. I've copied the package preserving the modes with:
cp -rp /usr/local/lib/python2.7/dist-packages/duplicity \
/usr/local/lib/python3.7/dist-packages/
This fixed it and allowed running duplicity.
I'm not sure if the fault was with my python installation, but guessed
that snap package should've run even in spite of that as it probably
had it's own environment. Posting it here in case somebody else has
the same issues and needs an idea on how to fix them.
--
You received this question notification because your team duplicity-team
is an answer contact for Duplicity.