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

ImportError: No module named flask #169

Closed
ranamanas opened this issue Mar 12, 2020 · 3 comments
Closed

ImportError: No module named flask #169

ranamanas opened this issue Mar 12, 2020 · 3 comments

Comments

@ranamanas
Copy link

ranamanas commented Mar 12, 2020

i have created an app using this code [https://github.com/tiangolo/uwsgi-nginx-flask-docker/tree/356fb1c49b62ac195620901a22d1ac62082bdf74/python2.7-alpine3.8]. when i execute the docker container from my local machine, its working fine. but when deploy to mesos then i noticed couple of things:

*** Operational MODE: preforking ***
Traceback (most recent call last):
File "./main.py", line 3, in
from flask import Flask
ImportError: No module named flask
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. GAME OVER ***

more log:

;uWSGI instance configuration
[uwsgi]
cheaper = 2
processes = 16
ini = /app/uwsgi.ini
module = main
callable = app
master = true
chmod-socket = 660
vacuum = true
die-on-term = true
ini = /etc/uwsgi/uwsgi.ini
socket = /tmp/uwsgi.sock
chown-socket = nginx:nginx
chmod-socket = 664
hook-master-start = unix_signal:15 gracefully_kill_them_all
need-app = true
die-on-term = true
plugin = python
show-config = true
;end of configuration

*** Starting uWSGI 2.0.17 (64bit) on [Thu Mar 12 00:52:25 2020] ***
compiled with version: 6.4.0 on 01 May 2018 17:28:25
os: Linux-4.4.0-1072-aws #82-Ubuntu SMP Fri Nov 2 15:00:21 UTC 2018
nodename: 2172e0780eb1
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /app
detected binary path: /usr/sbin/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 2.7.15 (default, Jul 22 2019, 09:39:07) [GCC 6.4.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7fe159b49820
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 1239640 bytes (1210 KB) for 16 cores

@tiangolo could you please help me, what could be the issue ?

@ranamanas
Copy link
Author

@tiangolo this issue got resolved but when i try to deploy in mesos, i see below error and in Docker file - i have exposed port 8520 and in main.py file , have used port 5100. Let me know - what could be the issue ?

*** Starting uWSGI 2.0.17 (64bit) on [Sat Mar 14 23:54:15 2020] ***
compiled with version: 6.4.0 on 27 March 2018 12:43:27
os: Linux-4.4.0-1072-aws #82-Ubuntu SMP Fri Nov 2 15:00:21 UTC 2018
nodename: 928d59bd45fd
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /app
detected binary path: /usr/sbin/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
2020/03/14 23:54:15 [emerg] 1355#1355: bind() to 0.0.0.0:8520 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:8520 failed (98: Address in use)
uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 2.7.15 (default, Aug 22 2018, 13:24:18) [GCC 6.4.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7f181acb8860
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 1239640 bytes (1210 KB) for 16 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x7f181acb8860 pid: 1356 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 1356)
spawned uWSGI worker 1 (pid: 1357, cores: 1)
spawned uWSGI worker 2 (pid: 1358, cores: 1)
running "unix_signal:15 gracefully_kill_them_all" (master-start)...
2020/03/14 23:54:15 [emerg] 1354#1354: bind() to 0.0.0.0:8520 failed (98: Address in use)

@tiangolo
Copy link
Owner

It seems like something where you are deploying that is trying to use the port 8520 but something else is already using that port.

But that's actually not related to this Docker image but to your infrastructure and where you are starting the container.

@ranamanas
Copy link
Author

thanks @tiangolo , actually i added "RUN unset -v PYTHONPATH" in docker file after that it started working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants