Skip to content
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

The library libcrypto could not be found #68

Open
freekvh opened this issue Oct 2, 2023 · 18 comments
Open

The library libcrypto could not be found #68

freekvh opened this issue Oct 2, 2023 · 18 comments
Labels
bug Something isn't working

Comments

@freekvh
Copy link

freekvh commented Oct 2, 2023

Bug description

calibre, version 6.17.0
ERROR: Install plugin failed: A problem occurred while installing this plugin. This plugin will now be uninstalled. Please post the error message in details below into the forum thread for this plugin and restart calibre.

Traceback (most recent call last):
File "/nix/store/jcwka24y0k09y494zh20achv414fi0l3-calibre-6.17.0/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
p.initialize()
File "calibre_plugins.deacsm.init", line 226, in initialize
from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
File "/tmp/calibre_6.17.0_tmp_i3rbcmnq/lrk5x84g.zip/libadobe.py", line 59, in
from oscrypto import keys
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in
from ._asymmetric import parse_certificate, parse_private, parse_public
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in
from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in
from .util import rand_bytes
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in
from ._openssl.util import rand_bytes
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in
from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in
from ._libcrypto_ctypes import (
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 28, in
raise LibraryNotFoundError('The library libcrypto could not be found')
oscrypto.errors.LibraryNotFoundError: The library libcrypto could not be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/nix/store/jcwka24y0k09y494zh20achv414fi0l3-calibre-6.17.0/lib/calibre/calibre/gui2/dialogs/plugin_updater.py", line 729, in install_clicked
plugin = add_plugin(zip_path)
File "/nix/store/jcwka24y0k09y494zh20achv414fi0l3-calibre-6.17.0/lib/calibre/calibre/customize/ui.py", line 520, in add_plugin
plugin = initialize_plugin(plugin, path_to_zip_file, PluginInstallationType.EXTERNAL)
File "/nix/store/jcwka24y0k09y494zh20achv414fi0l3-calibre-6.17.0/lib/calibre/calibre/customize/ui.py", line 715, in initialize_plugin
raise InvalidPlugin((
('Initialization of plugin %s failed with traceback:')
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
File "/nix/store/jcwka24y0k09y494zh20achv414fi0l3-calibre-6.17.0/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
p.initialize()
File "calibre_plugins.deacsm.init", line 226, in initialize
from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
File "/tmp/calibre_6.17.0_tmp_i3rbcmnq/lrk5x84g.zip/libadobe.py", line 59, in
from oscrypto import keys
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in
from ._asymmetric import parse_certificate, parse_private, parse_public
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in
from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in
from .util import rand_bytes
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in
from ._openssl.util import rand_bytes
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in
from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in
from ._libcrypto_ctypes import (
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 28, in
raise LibraryNotFoundError('The library libcrypto could not be found')
oscrypto.errors.LibraryNotFoundError: The library libcrypto could not be found
failed with traceback:
Traceback (most recent call last):
File "/nix/store/jcwka24y0k09y494zh20achv414fi0l3-calibre-6.17.0/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
p.initialize()
File "calibre_plugins.deacsm.init", line 226, in initialize
from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
File "/tmp/calibre_6.17.0_tmp_i3rbcmnq/lrk5x84g.zip/libadobe.py", line 59, in
from oscrypto import keys
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in
from ._asymmetric import parse_certificate, parse_private, parse_public
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in
from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in
from .util import rand_bytes
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in
from ._openssl.util import rand_bytes
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in
from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in
from ._libcrypto_ctypes import (
File "/home/myname/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 28, in
raise LibraryNotFoundError('The library libcrypto could not be found')
oscrypto.errors.LibraryNotFoundError: The library libcrypto could not be found

Operating system

Linux

Which version of Calibre are you running?

6.17.0

Which version of the ACSM Input plugin are you running?

0.0.16

Import type

No response

Further information

I'm on NixOS, I tried installing OpenSSL, but it seems deprecated. Not sure what else to try. For the record, I bought a book, site says it's an epub but it turns out to be some URLLINK.acsm file. Came here to find a solution to read my book :)

@iacchi
Copy link

iacchi commented Oct 12, 2023

I'm having a similar issue on Linux Debian Sid. I made sure the python3-oscryto package was installed. Unlike freekvh, who's getting a "The library libcrypto could not be found" error, I'm getting the error "Error detecting the version of libcrypto". Here's the complete error stack:

calibre, version 6.28.1
ERRORE: Installazione del Plugin fallita: Si è verificato un problema durante l'installazione di questo plugin. Il plugin sarà ora disinstallato. Per favore, riporta il messaggio di errore che segue nella discussione del forum relativa al plugin e riavvia calibre.

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 226, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
  File "/tmp/calibre_6.28.1_tmp_8zcmk_tb/_ccj8qdd.zip/libadobe.py", line 59, in <module>
    from oscrypto import keys
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in <module>
    from ._asymmetric import parse_certificate, parse_private, parse_public
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in <module>
    from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in <module>
    from .util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in <module>
    from ._openssl.util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in <module>
    from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in <module>
    from ._libcrypto_ctypes import (
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 47, in <module>
    raise LibraryNotFoundError('Error detecting the version of libcrypto')
oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/dialogs/plugin_updater.py", line 729, in _install_clicked
    plugin = add_plugin(zip_path)
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/customize/ui.py", line 520, in add_plugin
    plugin = initialize_plugin(plugin, path_to_zip_file, PluginInstallationType.EXTERNAL)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/customize/ui.py", line 715, in initialize_plugin
    raise InvalidPlugin((_('Initialization of plugin %s failed with traceback:')
calibre.customize.InvalidPlugin: Inizializzazione del plugin Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 226, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
  File "/tmp/calibre_6.28.1_tmp_8zcmk_tb/_ccj8qdd.zip/libadobe.py", line 59, in <module>
    from oscrypto import keys
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in <module>
    from ._asymmetric import parse_certificate, parse_private, parse_public
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in <module>
    from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in <module>
    from .util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in <module>
    from ._openssl.util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in <module>
    from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in <module>
    from ._libcrypto_ctypes import (
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 47, in <module>
    raise LibraryNotFoundError('Error detecting the version of libcrypto')
oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto
 non riuscita con messaggio:
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 226, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
  File "/tmp/calibre_6.28.1_tmp_8zcmk_tb/_ccj8qdd.zip/libadobe.py", line 59, in <module>
    from oscrypto import keys
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in <module>
    from ._asymmetric import parse_certificate, parse_private, parse_public
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in <module>
    from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in <module>
    from .util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in <module>
    from ._openssl.util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in <module>
    from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in <module>
    from ._libcrypto_ctypes import (
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 47, in <module>
    raise LibraryNotFoundError('Error detecting the version of libcrypto')
oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto

@iacchi
Copy link

iacchi commented Oct 12, 2023

I just realised now that there's a bugfix version downloadable from the mobileread forum: https://www.mobileread.com/forums/showpost.php?p=4157570&postcount=2
maybe it's worth mentioning it here on github as well? One needs to remove the plugin folder from the calibre data folder before attempting to install the bugfix version.

@ezracelli
Copy link

@freekvh I had the exact same issue, also on NixOS! I'm using an override to tell the custom oscrypto included by this plugin where to find libcrypto:

pkgs.calibre.overrideAttrs (attrs: {
  preFixup = (
    builtins.replaceStrings
      [
        ''
          --prefix PYTHONPATH : $PYTHONPATH \
        ''
      ]
      [
        ''
          --prefix LD_LIBRARY_PATH : ${pkgs.libressl.out}/lib \
          --prefix PYTHONPATH : $PYTHONPATH \
        ''
      ]
      attrs.preFixup
  );
})

I had to use libressl instead of openssl. When I tried openssl, I got the (different) "Error detecting the version of libcrypto" error mentioned above, but libressl worked fine.

WARNING: This will build calibre from scratch on your system, since Nix's cache doesn't include this customization. Builds in about 30 seconds on my desktop machine, but YMMV

@Leseratte10
Copy link
Owner

Yeah, I should really get around to releasing 0.1.0 with all this fixed. The latest beta version here on Github ( https://github.com/Leseratte10/acsm-calibre-plugin/suites/15775400817/artifacts/900357147 ) also has this bugfix included so that one should work as well. This is the same bug as in #67. All that needs to be done is download the latest alpha version from the Github Actions page which contains a fixed oscrypto version.

@Leseratte10 Leseratte10 added the bug Something isn't working label Oct 13, 2023
@mtill
Copy link

mtill commented Oct 15, 2023

Hi @Leseratte10 , I'm also facing this issue.
Unfortunately, the Link you provided ( https://github.com/Leseratte10/acsm-calibre-plugin/suites/15775400817/artifacts/900357147 ) seems to be broken ?

Best regards and thank you very much for all your efforts
mtill

@Leseratte10
Copy link
Owner

The link is working fine, but only for users logged in on Github - sadly Github doesn't allow making these links public.

@johunb
Copy link

johunb commented Nov 7, 2023

Using Calibre 6.29. If I use fixed plugin from here [https://www.mobileread.com/forums/showpost.php?p=4157570&postcount=2], I get this error:
calibre, version 6.29.0
ERROR: Unhandled exception: InvalidPlugin:Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

calibre 6.29 embedded-python: True
Linux-6.5.0-kali3-amd64-x86_64-with-glibc2.37 Linux ('64bit', 'ELF')
('Linux', '6.5.0-kali3-amd64', '#1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1kali1 (2023-10-09)')
Python 3.10.1
Interface language: None
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin
File "calibre/customize/ui.py", line 520, in add_plugin
File "calibre/customize/ui.py", line 715, in initialize_plugin
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

If I use this link: [ https://github.com/Leseratte10/acsm-calibre-plugin/suites/15775400817/artifacts/900357147 I get a download calibre-plugins.zip with same error loading as above

@johunb
Copy link

johunb commented Nov 7, 2023

calibre-migration.plugin.zip causes:

calibre, version 6.29.0
ERROR: Unhandled exception: InvalidPlugin:Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

calibre 6.29 embedded-python: True
Linux-6.5.0-kali3-amd64-x86_64-with-glibc2.37 Linux ('64bit', 'ELF')
('Linux', '6.5.0-kali3-amd64', '#1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1kali1 (2023-10-09)')
Python 3.10.1
Interface language: None
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin
File "calibre/customize/ui.py", line 520, in add_plugin
File "calibre/customize/ui.py", line 715, in initialize_plugin
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

calibre-plugin.zip causes:
calibre, version 6.29.0
ERROR: Unhandled exception: InvalidPlugin:Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

calibre 6.29 embedded-python: True
Linux-6.5.0-kali3-amd64-x86_64-with-glibc2.37 Linux ('64bit', 'ELF')
('Linux', '6.5.0-kali3-amd64', '#1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1kali1 (2023-10-09)')
Python 3.10.1
Interface language: None
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin
File "calibre/customize/ui.py", line 520, in add_plugin
File "calibre/customize/ui.py", line 715, in initialize_plugin
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

@johunb
Copy link

johunb commented Nov 7, 2023

Thank you for your help!

@twhitehead
Copy link

twhitehead commented Dec 7, 2023

Just a note that I worked around both it not being found and the version issue by editing the the libcrypto_ctypes.py file in the directory calibre had unpacked the plugin. Changed

if libcrypto_path is None:
    libcrypto_path = get_library('crypto', 'libcrypto.dylib', '42')
if not libcrypto_path:
    raise LibraryNotFoundError('The library libcrypto could not be found')

libcrypto = CDLL(libcrypto_path, use_errno=True)

to

#libcrypto_path = _backend_config().get('libcrypto_path')
#if libcrypto_path is None:
#    libcrypto_path = get_library('crypto', 'libcrypto.dylib', '42')
#if not libcrypto_path:
#    raise LibraryNotFoundError('The library libcrypto could not be found')

libcrypto = CDLL('libcrypto.so.3', use_errno=True)

as just regular loading locates this fine (memory says that I saw this was already loaded at runtime, but I am unable to duplicate that now, however, it still loads fine). And further down there was a

if not version_match:
    version_match = re.search('(?<=LibreSSL )(\\d\\.\\d(\\.\\d)?)\\b', version_string)
if not version_match:
    raise LibraryNotFoundError('Error detecting the version of libcrypto')

which obviously needs \\d+ if your crpyto version string has any components > 9 (i.e., more than one digit long). With those two changes it all just worked.

@Leseratte10
Copy link
Owner

Interesting, thanks for that patch. I don't know that much about library loading so I can't comment on the 1st change too much (I will need to look into that), but the 2nd change is something that I did for Linux as well a while ago (after openssl 3.0.10 came out) so I'll add that patch for the Mac library as well.

@twhitehead
Copy link

No problem. I did it again just now and updated the comment to have the correct library loading line (libcrypto.so.3).

Had read through the code, and the commented code is ultimately using the ctypes library location function find_library. It is pretty over the top, invoking gcc to try and locate the library it links against when you do a -lcrypto. To quote the reference

On Linux, find_library() tries to run external programs (/sbin/ldconfig, gcc, objdump and ld) to find the library file. It returns the filename of the library file.

Anyway, figured it made much more sense to just try and load it and let the system do its standard library loading location searching. Only item is that you do need the major version number. Wouldn't be hard to loop down trying versions from 3, or even 4 or 5, though.

@ToxicFrog
Copy link

I ran into the same problem (also on nixos), and the fixed version from github actions has timed out and is no longer available even when logged in. So here was my quick and dirty approach to getting a working install:

  • clone the repo
  • edit bundle_calibre_plugin.sh and package_modules.sh to use #!/usr/bin/env bash rather than #!/bin/bash
  • comment out everything related to building keyextract, since I don't care about extracting existing keys from a windows machine or a wineprefix at present
  • run bundle_calibre_plugin.sh

This gets a working plugin zip, but it also needs a bit of fiddling to properly find libcrypto. nix-shell on its own isn't enough, because then whatever it does to hunt down the library finds libcrypto.so.50 but the actual call to dlopen() can't. So:

  • nix-shell -p libressl
  • env LD_LIBRARY_PATH="${NIX_LDFLAGS##* -L}" calibre

and now it works, and I've successfully activated it with an anonymous ADE account.

@zoof
Copy link

zoof commented Dec 17, 2023

The link is working fine, but only for users logged in on Github - sadly Github doesn't allow making these links public.

The link is definitely dead now. New link?

@Leseratte10
Copy link
Owner

I've updated the included oscrypto version again, maybe that already fixes some of the issues.

Before I add the CDLL code patch by @twhitehead (if it's still needed with the new version) I need to test that some more to make sure it doesn't break any OS and/or older Calibre versions.

In case the link expires again I've also attached the current build of the plugin (64aaca3) here: calibre-plugin.zip

@zoof
Copy link

zoof commented Dec 19, 2023

Now working on Debian Bookworm.

@reedstrm
Copy link

reedstrm commented Feb 9, 2024

Just a bump to encourage making a release - I love the fact that I no longer need to maintain Wine only to run ADE to download library books!

@NathanFuller
Copy link

@Leseratte10 thanks for all the work you've put into this! I tried installing the attached build from your comment above and got the error message below. Please advise?

calibre, version 6.13.0
ERROR: Unhandled exception: <b>InvalidPlugin</b>:Initialization of plugin Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 677, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 232, in initialize
    deacsmprefs = prefs.DeACSM_Prefs()
                  ^^^^^^^^^^^^^^^^^^
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
 failed with traceback:
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 677, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 232, in initialize
    deacsmprefs = prefs.DeACSM_Prefs()
                  ^^^^^^^^^^^^^^^^^^
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'


calibre 6.13  embedded-python: False
Linux-6.1.0-18-amd64-x86_64-with-glibc2.36 Linux ('64bit', 'ELF')
('Linux', '6.1.0-18-amd64', '#1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01)')
Python 3.11.2
Interface language: None
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 677, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 232, in initialize
    deacsmprefs = prefs.DeACSM_Prefs()
                  ^^^^^^^^^^^^^^^^^^
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/preferences/plugins.py", line 325, in add_plugin
    plugin = add_plugin(path)
             ^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/customize/ui.py", line 487, in add_plugin
    plugin = initialize_plugin(plugin, path_to_zip_file, PluginInstallationType.EXTERNAL)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/customize/ui.py", line 682, in initialize_plugin
    raise InvalidPlugin((_('Initialization of plugin %s failed with traceback:')
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 677, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 232, in initialize
    deacsmprefs = prefs.DeACSM_Prefs()
                  ^^^^^^^^^^^^^^^^^^
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
 failed with traceback:
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 677, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 232, in initialize
    deacsmprefs = prefs.DeACSM_Prefs()
                  ^^^^^^^^^^^^^^^^^^
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests