[BUG] ModuleNotFoundError: No module named 'flask' #704

Closed
opened 2026-02-04 22:01:13 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @zeyadtamimi on GitHub (Feb 22, 2023).

The bug

It seems that the latest version of the 1.48.0 machine learning container has some form of packaging issues where flask is not being installed.

Upon trying to start the docker containers I immediately encounter an error:

Traceback (most recent call last):
  File "/usr/src/app/src/main.py", line 2, in <module>
    from flask import Flask, request
ModuleNotFoundError: No module named 'flask'

I have tried to run the machine learning container with both python and python3 ( in case this was a python3 issue ) with no avail.

Also, please note that I am not using docker compose, instead I am using manual docker run / docker pull commands. Specifically I execute the following bash script:

ML_NAME="photo-ml"                                                               
ML_IMAGE="altran1502/immich-machine-learning:release"
FS_BASE="/containers/photo"

docker run -d \                                                                      
   --name "$ML_NAME" \                                                               
   --hostname="$ML_NAME" \                                                                                                             
   --restart=always \                                                                
   -e NODE_ENV="production" \                                                        
   -v /media/photos:/usr/src/app/upload \                                            
   -v $FS_BASE/ml/cache:/cache \                                                     
   --user 1008:1001 \                                                                
   $ML_IMAGE \                                                                       
   python3 src/main.py

I understand that this might be related to #1821 but since that one is more geared towards k8s I am opening this just in case.

Thanks so much in advance.

The OS that Immich Server is running on

Arch Linux, x86_64, Linux Kernel 6.1.12

Version of Immich Server

v1.48.0

Version of Immich Mobile App

v1.48.0

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

N/A

Your .env content

N/A

Reproduction steps

Run the docker run command provided in the description.

Additional information

No response

Originally created by @zeyadtamimi on GitHub (Feb 22, 2023). ### The bug It seems that the latest version of the 1.48.0 machine learning container has some form of packaging issues where `flask` is not being installed. Upon trying to start the docker containers I immediately encounter an error: ``` Traceback (most recent call last): File "/usr/src/app/src/main.py", line 2, in <module> from flask import Flask, request ModuleNotFoundError: No module named 'flask' ``` I have tried to run the machine learning container with both `python` and `python3` ( in case this was a python3 issue ) with no avail. Also, please note that I am not using docker compose, instead I am using manual docker run / docker pull commands. Specifically I execute the following bash script: ``` ML_NAME="photo-ml" ML_IMAGE="altran1502/immich-machine-learning:release" FS_BASE="/containers/photo" docker run -d \ --name "$ML_NAME" \ --hostname="$ML_NAME" \ --restart=always \ -e NODE_ENV="production" \ -v /media/photos:/usr/src/app/upload \ -v $FS_BASE/ml/cache:/cache \ --user 1008:1001 \ $ML_IMAGE \ python3 src/main.py ``` I understand that this might be related to #1821 but since that one is more geared towards k8s I am opening this just in case. Thanks so much in advance. ### The OS that Immich Server is running on Arch Linux, x86_64, Linux Kernel 6.1.12 ### Version of Immich Server v1.48.0 ### Version of Immich Mobile App v1.48.0 ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML N/A ``` ### Your .env content ```Shell N/A ``` ### Reproduction steps ``` Run the docker run command provided in the description. ``` ### Additional information _No response_
Author
Owner

@zeyadtamimi commented on GitHub (Feb 22, 2023):

I see this issue is being fixed by #1830, I will close when it merges.

@zeyadtamimi commented on GitHub (Feb 22, 2023): I see this issue is being fixed by #1830, I will close when it merges.
Author
Owner

@alextran1502 commented on GitHub (Feb 22, 2023):

Can you try using the image ghcr.io/immich-app/immich-machine-learning:pr-1830 and confirm that it fixes the issue?

@alextran1502 commented on GitHub (Feb 22, 2023): Can you try using the image `ghcr.io/immich-app/immich-machine-learning:pr-1830` and confirm that it fixes the issue?
Author
Owner

@zeyadtamimi commented on GitHub (Feb 23, 2023):

Hey, this issue is fixed and I no longer see the flask issue. I do however see a permission issue that I suspect would be fixed by pr-1831

@zeyadtamimi commented on GitHub (Feb 23, 2023): Hey, this issue is fixed and I no longer see the flask issue. I do however see a permission issue that I suspect would be fixed by pr-1831
Author
Owner

@alextran1502 commented on GitHub (Feb 23, 2023):

there might be some misunderstanding, I don't think #1831 fix anything related to Docker

@alextran1502 commented on GitHub (Feb 23, 2023): there might be some misunderstanding, I don't think #1831 fix anything related to Docker
Author
Owner

@zeyadtamimi commented on GitHub (Feb 23, 2023):

Oh never mind, I misquoted. But I am getting some weird permission issues that I guess Ill open another issue for.

@zeyadtamimi commented on GitHub (Feb 23, 2023): Oh never mind, I misquoted. But I am getting some weird permission issues that I guess Ill open another issue for.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#704