yeti icon indicating copy to clipboard operation
yeti copied to clipboard

Yeti failing to run as Docker environment (ImportError: cannot import name 'parse_rule' from 'werkzeug.routing')

Open dspruell opened this issue 2 years ago • 3 comments

Description

When bringing up a new Yeti Docker environment using the default Dockerfile and docker-compose.yaml, all containers remain running except one. Looking at the logs, it appears there are several containers with failures, including a fatal exception in Flask.

Environment

Question Answer
Git commit commit 56a641bcaae8e0644e0c1ccc8623d2ccc61ffe8f
OS version Debian GNU/Linux 11 (bullseye)
Browser N/A
# docker version
Client:
 Version:           20.10.5+dfsg1
 API version:       1.41
 Go version:        go1.15.15
 Git commit:        55c4c88
 Built:             Mon May 30 18:34:49 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.5+dfsg1
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.15.15
  Git commit:       363e9a8
  Built:            Mon May 30 18:34:49 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.13~ds1
  GitCommit:        1.4.13~ds1-1~deb11u2
 runc:
  Version:          1.0.0~rc93+ds1
  GitCommit:        1.0.0~rc93+ds1-5+deb11u2
 docker-init:
  Version:          0.19.0
  GitCommit:

# docker-compose version
docker-compose version 1.25.0, build unknown
docker-py version: 4.1.0
CPython version: 3.9.2
OpenSSL version: OpenSSL 1.1.1n  15 Mar 2022

Steps to Reproduce

  1. Reference documentation at https://github.com/yeti-platform/yeti/blob/master/extras/docker/README.md
  2. cd yeti/extras/docker/dev
  3. Run docker-compose up -d
  4. Verify running containers with docker-compose ps and logging with docker-compose logs

Expected behavior

Expected Yeti services to come up and stay running, with app server bound to network.

Actual behavior

# docker-compose up -d
Creating network "dev_default" with the default driver
Creating dev_mongodb_1 ... done
Creating dev_redis_1   ... done
Creating dev_yeti_1    ... done
Creating dev_exports_1   ... done
Creating dev_feeds_1     ... done
Creating dev_oneshot_1   ... done
Creating dev_analytics_1 ... done
Creating dev_beat_1      ... done

All services but one appear to have containers that continue running. The main Yeti web server container doesn't remain running but appears to throw an exception, "ImportError: cannot import name 'parse_rule' from 'werkzeug.routing'." The resultant state after running docker-compose up -d is:

# docker-compose ps
     Name                    Command               State      Ports  
---------------------------------------------------------------------
dev_analytics_1   /docker-entrypoint.sh anal ...   Up                
dev_beat_1        /docker-entrypoint.sh beat       Up                
dev_exports_1     /docker-entrypoint.sh exports    Up                
dev_feeds_1       /docker-entrypoint.sh feeds      Up                
dev_mongodb_1     docker-entrypoint.sh mongod      Up       27017/tcp
dev_oneshot_1     /docker-entrypoint.sh oneshot    Up                
dev_redis_1       docker-entrypoint.sh redis ...   Up       6379/tcp 
dev_yeti_1        /docker-entrypoint.sh webs ...   Exit 1

Log output for this container:

# docker-compose logs --no-color -t | grep yeti_1 
Attaching to dev_beat_1, dev_analytics_1, dev_oneshot_1, dev_exports_1, dev_feeds_1, dev_yeti_1, dev_mongodb_1, dev_redis_1
yeti_1       | 2022-08-23T19:47:58.955328803Z Traceback (most recent call last):
yeti_1       | 2022-08-23T19:47:58.955394198Z   File "/opt/yeti/yeti.py", line 7, in <module>
yeti_1       | 2022-08-23T19:47:58.955415278Z     from core.web import webapp
yeti_1       | 2022-08-23T19:47:58.955427501Z   File "/opt/yeti/core/web/__init__.py", line 1, in <module>
yeti_1       | 2022-08-23T19:47:58.955465722Z     from core.web.webapp import webapp
yeti_1       | 2022-08-23T19:47:58.955478248Z   File "/opt/yeti/core/web/webapp.py", line 14, in <module>
yeti_1       | 2022-08-23T19:47:58.955491179Z     from core.web.api import api
yeti_1       | 2022-08-23T19:47:58.955503740Z   File "/opt/yeti/core/web/api/__init__.py", line 1, in <module>
yeti_1       | 2022-08-23T19:47:58.955517038Z     from core.web.api.api import api
yeti_1       | 2022-08-23T19:47:58.955528669Z   File "/opt/yeti/core/web/api/api.py", line 35, in <module>
yeti_1       | 2022-08-23T19:47:58.955540677Z     from core.web.api.observable import ObservableSearch, Observable
yeti_1       | 2022-08-23T19:47:58.955552454Z   File "/opt/yeti/core/web/api/observable.py", line 5, in <module>
yeti_1       | 2022-08-23T19:47:58.955564689Z     from flask_classy import route
yeti_1       | 2022-08-23T19:47:58.955576567Z   File "/usr/local/lib/python3.8/dist-packages/flask_classy.py", line 16, in <module>
yeti_1       | 2022-08-23T19:47:58.955588588Z     from werkzeug.routing import parse_rule
yeti_1       | 2022-08-23T19:47:58.955600482Z ImportError: cannot import name 'parse_rule' from 'werkzeug.routing' (/usr/local/lib/python3.8/dist-packages/werkzeug/routing/__init__.py)

dspruell avatar Aug 24 '22 02:08 dspruell

If you want a workaround, you can set the version of Werzeug in requirements.txt

werkzeug==2.1.2

sebdraven avatar Aug 24 '22 06:08 sebdraven

Hi, Thx for the issue, we'll check. If you want a stable version, you can use https://github.com/yeti-platform/yeti/releases/tag/1.8.5

The problem is that now the dependency file (requirements.txt) do not specify a specific version and that a know issue #726 #725 Solution is flask==2.1.2 werkzeug==2.1.2 ( as I remember, I need a flask of a specific version too )

dumprop avatar Aug 24 '22 07:08 dumprop

@dumprop yes

If you want a workaround, you can set the version of Werzeug in requirements.txt

werkzeug==2.1.2

sebdraven avatar Aug 24 '22 07:08 sebdraven

Is there any solution to this problem? I'm having the same issue.

cesciam avatar Mar 01 '23 17:03 cesciam

you setup your requierements.txt with werkzeug==2.1.2 before building

sebdraven avatar Mar 01 '23 17:03 sebdraven