-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
B2 backend import error message could reveal the missing module #14
Comments
I also had similar issues with the BackendException not reporting the underlying issue. In my case I guessed what the issue was and ran the b2 executable directly which gave me a stacktrace telling me what module was missing and how to fix it. The underlying issue is the b2 pip package is missing one or more dependencies. |
I've run into this issue multiple times, and each time it's |
This bug has still not been fixed. I am getting "b2" not being installed. But what I installed is b2sdk, so is it looking for the wrong thing? |
When I manually loaded each module, for the first one, from b2sdk.api import B2Api, I got Not sure why the error code suggested above reported "b2" and not sqlite3, but the cause in my case is the same as the original poster's. |
@mauricev, I think that on python 2.7 you need to downgrade the b2 module. I did and that worked for me.
(or try different values for the version number). |
Merge request to partially mitigate this issue on Python 3.6+: https://gitlab.com/duplicity/duplicity/-/merge_requests/33 |
b2 version 1.4.2 and b2sdk version 1.1.4 work. |
Sometimes import can fail because one of B2's dependencies is broken. The trick here is to query the "name" attribute of ModuleNotFoundError to see if B2 is the module that failed. Unfortunately this only works on Python 3.6+. In older versions, the original behavior is retained. This partially mitigates the issue described in henrysher/duplicity#14.
While trying to backup to Backblaze, Duplicity raised a
BackendException
reporting, "B2 backend requires B2 Python APIs (pip install b2)". Theb2
module already was installed, but supporting SQLite development files were not, so the actual import failure was for the_sqlite3
module. An improvedBackendException
message could reveal the actual problem and reduce debugging time.Environment
The Long Story
A check in my Python virtual environment confirmed that
b2
was already installed.To better understand the cause of the exception, I modified
b2backend.py
to includeImportError
details in the raisedBackendException
.Rerunning Duplicity gave this more informative message: "BackendException: B2 backend requires B2 Python APIs (pip install b2): No module named _sqlite3".
My server runs Ubuntu 14.04, which froze Python at version 2.7.6. To satisfy Duplicity's need for version 2.7.9 or later, I downloaded and compiled the latest Python 2.7, which is version 2.7.14. My Ubuntu server lacked the SQLite 3 development files, so my Python build omitted SQLite support.
I corrected the problem by installing the Ubuntu
libsqlite3-dev
package, rebuilding Python, and rebuilding Duplicity. With SQLite support in Python, Duplicity successfully backs up to Backblaze.The text was updated successfully, but these errors were encountered: