05-17-2024, 11:01 AM | #1 |
Enthusiast
Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
use module in metadata plugin
i am trying to use fuzzywuzzy in my metadata plugin, but as soon as i try to deploy it it will say:
Code:
calibre, version 7.10.0 שגיאה: Unhandled exception: <b>ModuleNotFoundError</b>:No module named 'fuzzywuzzy' and did everything that is written there (the empty txt file, copying the fuzzywuzzy code from github into my zip ...) then i got: Code:
calibre, version 7.10.0 שגיאה: Unhandled exception: <b>ModuleNotFoundError</b>:No module named 'calibre_plguins' |
05-17-2024, 11:10 AM | #2 |
Guru
Posts: 783
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
|
Typo?
calibre_plguins => calibre_plugins |
Advert | |
|
05-17-2024, 11:57 AM | #3 |
Enthusiast
Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
the spell issue was in the referenced post i mentioned, thanks for that, i fixed it, but now i get:
Code:
calibre, version 7.10.0 שגיאה: Unhandled exception: <b>ModuleNotFoundError</b>:No module named 'fuzzywuzzy' calibre 7.10 embedded-python: True Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19045') Python 3.11.5 Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free') Interface language: he EXE path: C:\Program Files\Calibre2\calibre.exe Successfully initialized third party plugins: Library Genesis (1, 2, 0) && Reading List (1, 15, 4) Traceback (most recent call last): File "calibre\gui2\preferences\plugins.py", line 322, in add_plugin File "calibre\customize\ui.py", line 525, in add_plugin File "calibre\customize\ui.py", line 76, in load_plugin File "calibre\customize\zipplugin.py", line 306, in load File "importlib\__init__.py", line 126, in import_module File "<frozen importlib._bootstrap>", line 1204, in _gcd_import File "<frozen importlib._bootstrap>", line 1176, in _find_and_load File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 690, in _load_unlocked File "calibre\customize\zipplugin.py", line 205, in exec_module File "calibre_plugins.evrit2.__init__", line 9, in <module> File "calibre\customize\zipplugin.py", line 205, in exec_module File "calibre_plugins.evrit2.fuzzywuzzy.fuzz", line 14, in <module> File "calibre\customize\zipplugin.py", line 205, in exec_module File "calibre_plugins.evrit2.fuzzywuzzy.utils", line 5, in <module> ModuleNotFoundError: No module named 'fuzzywuzzy' Code:
evrit2/ │ ├── __init__.py ├── readme.txt ├── fuzzywuzzy/ │ ├── __init__.py │ ├── fuzz.py │ └── ... (more files) Code:
import json import re import time import unicodedata from collections.abc import Iterable, Mapping from queue import Empty, Queue from threading import Event from typing import Callable from calibre_plugins.evrit2.fuzzywuzzy import fuzz from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.ebooks.metadata.book.base import Metadata from calibre.ebooks.metadata.sources.base import Source from calibre.utils.logging import Log from calibre.utils.date import parse_date, utcnow ... Last edited by dandman; 05-17-2024 at 12:01 PM. |
05-17-2024, 12:09 PM | #4 |
Enthusiast
Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
ok i got it, in the fuzzywuzzy code there is a file named utils.py
and in line 5 it has import that tries to import: Code:
from fuzzywuzzy.string_processing import StringProcessor Code:
from calibre_plugins.evrit2.fuzzywuzzy.string_processing import StringProcessor Note: this is a very strange manner to manage packages in python (rather then use the built in delivery system of pip), the only downside i can think of is if the user has a firewall blocking pip from installing requirements / dependencies in my view it is a flawed architecture and practice |
05-17-2024, 12:10 PM | #5 |
Enthusiast
Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
admin, please add SOLVED! as a prefix to this post title (and delete this request)
10x |
Advert | |
|
05-17-2024, 03:34 PM | #6 | |
Bibliophagist
Posts: 40,603
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
If you look at the number of times Linux users have installed their distro version of calibre and then run into issues due to Python which are cured by using the install procedure from calibre's website. I.e., one recent poster complaining that his calibre install had problems with Python 3.12. |
|
05-17-2024, 07:21 PM | #7 | |
null operator (he/him)
Posts: 21,006
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
05-17-2024, 07:44 PM | #8 |
Enthusiast
Posts: 29
Karma: 10545
Join Date: May 2024
Device: none
|
doesn't change the fact that this is a bad practice, there are tons of products successfully managing requirements.txt with min or max versions,
if the problem is dependency collision, then Caliber should have been the one to include and reference all the external libraries it needs (and not the plugins or users), and it should have load the user plugins in a separate runtime, allowing each plugin to run based on the requirements it needs (without the user having to deal with it or take care of it), but as i said before ... i guess i am not the first to notice these cavities and not here to change the product, just to understand how to make it work |
05-17-2024, 08:20 PM | #9 | |
Bibliophagist
Posts: 40,603
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Unlike in my career in IT where we could control updates, what software was installed and manage requirements at the domain level, that type of control is not available on a personal computer. We had a fairly homogeneous environment with end users using about 80% Windows, 20% MacOS and a few Linux installs. Even there, we ran into issues where program updates were iffy. The Linux boxes were more or less "managed" by ignoring them. |
|
Tags |
import, library, metadata plugin, module |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to include a Python module with the plugin | SylvanKnight | Development | 11 | 12-04-2022 05:46 AM |
[Metadata Source Plugin] Empty Plugin? (Fake Identifier) | mneimeyer | Plugins | 3 | 11-11-2019 09:07 PM |
Regarding using metadata objects in identify method of metadata download plugin api | aprekates | Development | 1 | 07-06-2014 04:35 AM |
Developing plugin to process notes from Sony PRS-T1: no module named | sjvs | Development | 19 | 03-25-2012 12:53 PM |
No Module name Tkinter on plugin import | foghat | Plugins | 1 | 11-11-2010 08:11 PM |