janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.98k stars 1.39k forks source link

Migrate from `iso639` to `iso639-lang` #3140

Open C0rn3j opened 2 months ago

C0rn3j commented 2 months ago

iso639 won't work with Python 3.12, maintainer said this February that they are not actively using or developing the library anymore, and that a future version would still need to support Python back to 2.6.

iso639-lang exist which supports 3.7-3.12, which seems perfect for the project as currently minimum marked version for calibre-web is 3.7.

PR in another project that did the same migration can be found here.


EDIT: This may actually not be strictly needed for 3.12 support, but the project being basically dead is not a good outlook for future versions.

capitanh commented 2 months ago

I support this. After upgrading to Ubuntu 24 (Python 3.12.3) calibre fails to start: *** Cannot import iso-639 module, it is needed to run calibre-web, please install it using "pip install iso-639" *** I haven't been able (yet) to install iso-639 in any way (pip, pipx, apt...) so migrating to lso639-lang looks like a good plan...

C0rn3j commented 2 months ago

You need python-setuptools as a mandatory dependency on 3.12 which might work around the issue for now, it did for me on Arch Linux.

capitanh commented 2 months ago

You need python-setuptools as a mandatory dependency on 3.12 which might work around the issue for now, it did for me on Arch Linux.

I already have python3-setuptools installed (68.1.2-2ubuntu1), how do you suggest to install iso639 packages? pipx returns an error: No apps associated with package iso-639 or its dependencies (same for iso-639) pip no longer installs anything: error: externally-managed-environment and apt can't find the package: E: Unable to locate package python3-iso639 Any help would be greatly appreciated...

C0rn3j commented 2 months ago

Set up a python venv for it and install all the deps there I suppose, then make calibre-web use the venv

On Mon, Sep 2, 2024, 18:30 Luis Novo @.***> wrote:

You need python-setuptools as a mandatory dependency on 3.12 which might work around the issue for now, it did for me on Arch Linux.

I already have python3-setuptools installed (68.1.2-2ubuntu1), how do you suggest to install iso639 packages? pipx returns an error: No apps associated with package iso-639 or its dependencies (same for iso-639) pip no longer installs anything: error: externally-managed-environment and apt can't find the package: E: Unable to locate package python3-iso639 Any help would be greatly appreciated...

— Reply to this email directly, view it on GitHub https://github.com/janeczku/calibre-web/issues/3140#issuecomment-2325074609, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMQXEQGSO4Y2JWMKLI63Q3ZUSHD5AVCNFSM6AAAAABNO7YUSWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRVGA3TINRQHE . You are receiving this because you authored the thread.Message ID: @.***>

capitanh commented 2 months ago

Set up a python venv for it and install all the deps there I suppose, then make calibre-web use the venv On Mon, Sep 2, 2024, 18:30 Luis Novo @.> wrote: You need python-setuptools as a mandatory dependency on 3.12 which might work around the issue for now, it did for me on Arch Linux. I already have python3-setuptools installed (68.1.2-2ubuntu1), how do you suggest to install iso639 packages? pipx returns an error: No apps associated with package iso-639 or its dependencies (same for iso-639) pip no longer installs anything: error: externally-managed-environment and apt can't find the package: E: Unable to locate package python3-iso639 Any help would be greatly appreciated... — Reply to this email directly, view it on GitHub <#3140 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMQXEQGSO4Y2JWMKLI63Q3ZUSHD5AVCNFSM6AAAAABNO7YUSWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRVGA3TINRQHE . You are receiving this because you authored the thread.Message ID: @.>

Thanks for your suggestion. Unfortunately, your original comment about incompatibilty between python 3.12 and iso639 still stands. Even if I could install the package with pipx inside a venv, it wouldn't work...

I'll keep trying, anyway, will let you know if there is any advance in the matter.

C0rn3j commented 2 months ago

Unfortunately, your original comment about incompatibilty between python 3.12 and iso639 still stands.

I did get it working on Arch in the end as per the comments above, which uses 3.12, but it newly requires setuptools to be available.
You should be able to get it working.

OzzieIsaacs commented 2 months ago

The newest nightly version already has a fix for it (hopefully): You will get a message during startup: "Python 3.12 isn't compatible with iso-639. Please install pycountry" (on console, because logging isn't working at the time iso-639 included during startup). My plan was to wait until the next release to address this: Option1: iso639 will have a new version with a fix for it -> everything stays as is Option2: iso639 will have NOT a new version with a fix for it -> use pycountry

Pycountry is already supported as there had been problems with debian (I guess?) in the past.

For now the workaround is delete the line iso639 in the requeirements.txt file and install pycountry

capitanh commented 2 months ago

The newest nightly version already has a fix for it (hopefully): You will get a message during startup: "Python 3.12 isn't compatible with iso-639. Please install pycountry" (on console, because logging isn't working at the time iso-639 included during startup). My plan was to wait until the next release to address this: Option1: iso639 will have a new version with a fix for it -> everything stays as is Option2: iso639 will have NOT a new version with a fix for it -> use pycountry

Pycountry is already supported as there had been problems with debian (I guess?) in the past.

For now the workaround is delete the line iso639 in the requeirements.txt file and install pycountry

Yes, that worked :-) Thanks a lot

deldesir commented 3 weeks ago

Option1: iso639 will have a new version with a fix for it -> everything stays as is Option2: iso639 will have NOT a new version with a fix for it -> use pycountry

Thanks for the workaround. This reminds me of the cryptography requirement issue when installing Calibre-Web from source. Would it be OK if a step is added in the Manual Installation to recommend users to run pip install pycountry?

C0rn3j commented 3 weeks ago

Option1: iso639 will have a new version with a fix for it -> everything stays as is Option2: iso639 will have NOT a new version with a fix for it -> use pycountry

Thanks for the workaround. This reminds me of the cryptography requirement issue when installing Calibre-Web from source. Would it be OK if a step is added in the Manual Installation to recommend users to run pip install pycountry?

@deldesir
No, setuptools should be added to requirements.txt until this migration is sorted to fix the dependencies, as per my earlier messages and per the upstream docs.

"Python 3.12 isn't compatible with iso-639"

@OzzieIsaacs
It is, but Python 3.12 no longer preinstalls setuptools into the env.

deldesir commented 3 weeks ago

👍 @C0rn3j for pointing out the removal of setuptools preinstall in venv. I understand that adding it to requirements.txt is part of the temporary workaround, right?

C0rn3j commented 3 weeks ago

👍 @C0rn3j for pointing out the removal of setuptools preinstall in venv. I understand that adding it to requirements.txt is part of the temporary workaround, right?

No, that's THE workaround, or rather the fix for the current build system.

The library (iso639) then works.

It still remains unmaintained and needs to be migrated away from when possible, but Calibre-web will work again as is with the fix.

That said, if pycountry is supported and fulfils the needs of the project, iso639 should simply be replaced for pycountry in requirements.txt.