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

Docker ModuleNotFoundError #668

Closed
onyto opened this issue Jan 14, 2024 · 8 comments · Fixed by #670 or #746
Closed

Docker ModuleNotFoundError #668

onyto opened this issue Jan 14, 2024 · 8 comments · Fixed by #670 or #746
Labels
Bug Something isn't working Docker Docker image github_actions Pull requests that update GitHub Actions code

Comments

@onyto
Copy link

onyto commented Jan 14, 2024

Describe the bug
The app doesn't start because there is no module named 'natsort'

Error message:

sudo docker run --rm -v "$(pwd):/app" ghcr.io/ciromattia/kcc:latest
Traceback (most recent call last):
  File "/opt/kcc/kcc-c2e.py", line 33, in <module>
    startC2E()
  File "/opt/kcc/kindlecomicconverter/startup.py", line 47, in startC2E
    from .comic2ebook import main
  File "/opt/kcc/kindlecomicconverter/comic2ebook.py", line 37, in <module>
    from natsort import os_sorted
ModuleNotFoundError: No module named 'natsort'

To Reproduce
Steps to reproduce the behavior:

  1. download latest docker image
  2. run it

Expected behavior
App should run successfully

@axu2 axu2 added the Docker Docker image label Jan 19, 2024
@axu2
Copy link
Collaborator

axu2 commented Jan 19, 2024

I do not use Docker, but I think it's due to these lines:
https://github.com/ciromattia/kcc/blob/master/Dockerfile-base#L69
https://github.com/ciromattia/kcc/blob/master/Dockerfile-base#L125

missing natsort[fast]

Do you mind adding them in a PR and testing? @onyto

Additionally, is there some way for Docker to test if it can even run without failing?

@axu2 axu2 added dependencies Pull requests that update a dependency file good first issue Good for newcomers labels Jan 20, 2024
@onyto
Copy link
Author

onyto commented Jan 21, 2024

You have pointed out the lines for the arm build but I'm using amd64 which should install natsort from the requirements.txt.
https://github.com/ciromattia/kcc/blob/v5.6.5/Dockerfile-base#L14
https://github.com/ciromattia/kcc/blob/v5.6.5/requirements.txt#L9

I did a pip list inside the container and confirmed that natsort is missing:

$ sudo docker run -it --entrypoint /bin/bash ghcr.io/ciromattia/kcc:latest
root@bea83532fe0f:/app# pip list
Package                       Version
----------------------------- -------
cffi                          1.15.1
distro                        1.8.0
mozjpeg-lossless-optimization 1.1.2
Pillow                        9.5.0
pip                           22.3.1
psutil                        5.9.5
pycparser                     2.21
PyQt5                         5.15.9
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.12.1
python-slugify                8.0.1
raven                         6.10.0
setuptools                    65.5.0
text-unidecode                1.3

But doing a python -m pip install -r /opt/kcc/requirements.txt installs everything correctly:

root@bea83532fe0f:/app# pip list
Package                       Version
----------------------------- ----------
certifi                       2023.11.17
cffi                          1.15.1
charset-normalizer            3.3.2
distro                        1.8.0
fastnumbers                   5.1.0
idna                          3.6
mozjpeg-lossless-optimization 1.1.2
natsort                       8.4.0
Pillow                        9.5.0
pip                           22.3.1
psutil                        5.9.5
pycparser                     2.21
PyQt5                         5.15.9
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.12.1
python-slugify                8.0.1
raven                         6.10.0
requests                      2.31.0
setuptools                    65.5.0
text-unidecode                1.3
urllib3                       2.1.0

Now the app works:

root@bea83532fe0f:/app# python /opt/kcc/kcc-c2e.py -h                                                                                                                                                                                                         
comic2ebook v5.6.5 - Written by Ciro Mattia Gonano and Pawel Jastrzebski.                                                                                                                                                                                     
usage: kcc-c2e [options] [input]
...

I guess the problem is with building the image then.

@axu2
Copy link
Collaborator

axu2 commented Jan 22, 2024

Thanks for looking into it, I see the real issue.

The base docker image hasn't been updated in 5 months. It doesn't run automatically.

image

https://github.com/ciromattia/kcc/actions/workflows/docker-base-publish.yml

@axu2 axu2 changed the title Docker: natsort module missing Dockerfile-base not running in CI automatically Jan 22, 2024
@axu2 axu2 added Bug Something isn't working github_actions Pull requests that update GitHub Actions code and removed dependencies Pull requests that update a dependency file good first issue Good for newcomers labels Jan 22, 2024
@axu2
Copy link
Collaborator

axu2 commented Jan 22, 2024

Alright, manually re-ran the workflows. Hopefully works now. @onyto

@darodi this might be the source of your docker issues.

@axu2 axu2 changed the title Dockerfile-base not running in CI automatically Docker natsort missing Jan 22, 2024
@onyto
Copy link
Author

onyto commented Jan 22, 2024

I just pulled the image and everything seems to be working now 👍

@onyto onyto closed this as completed Jan 22, 2024
@axu2 axu2 changed the title Docker natsort missing Docker ModuleNotFoundError Jan 22, 2024
@axu2
Copy link
Collaborator

axu2 commented Jan 25, 2024

Gonna reopen since this same issue might reoccur next time dependencies change.

@darodi
Copy link
Collaborator

darodi commented Jan 29, 2024

@axu2

Last docker image is broken for arm/v7
and maybe other platforms since

Please keep v5.7.0 a pre-release until I fix it.
I'll try to find some time for that this week.

rodi@computer:/mnt/c/test$ docker run --platform linux/arm/v7 --rm -v "$(pwd):/app" ghcr.io/ciromattia/kcc:latest -p KPW5 ./258.cbz
ERROR: psutil 5.0.0+, python-slugify 1.2.1+, Pillow 5.2.0+ is not installed!

I said before, here, that docker needed to be tested/adapted before a release.

partly done in
darodi@e37559b
I'm still testing docker before releasing a 5.7.0beta
Originally posted by @darodi in #618 (comment)

work in progress in branch
https://github.com/darodi/kcc/tree/beta_release

@axu2
Copy link
Collaborator

axu2 commented Sep 30, 2024

@onyto 6.2.0 has a fixed docker version now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Docker Docker image github_actions Pull requests that update GitHub Actions code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants