mushorg / tanner

He who flays the hide
GNU General Public License v3.0
220 stars 101 forks source link

Docker Installation of Tanner fails due to some dependencies #423

Closed achute closed 6 months ago

achute commented 2 years ago

When I tried to install tanner using docker compose in Mac, I ran into the following python dependency issues:

tanner_web      | Traceback (most recent call last):
tanner_web      |   File "/opt/tanner/tanner-env/bin/tannerweb", line 4, in <module>
tanner_web      |     __import__('pkg_resources').run_script('Tanner==0.6.0', 'tannerweb')
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/pkg_resources/__init__.py", line 651, in run_script
tanner_web      |     self.require(requires)[0].run_script(script_name, ns)
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1455, in run_script
tanner_web      |     exec(script_code, namespace, namespace)
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/Tanner-0.6.0-py3.9.egg/EGG-INFO/scripts/tannerweb", line 4, in <module>
tanner_web      |     __import__('pkg_resources').run_script('Tanner==0.6.0', 'tannerweb')
tanner_web      |   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
tanner_web      |   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
tanner_web      |   File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
tanner_web      |   File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
tanner_web      |   File "<frozen zipimport>", line 259, in load_module
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/Tanner-0.6.0-py3.9.egg/tanner/web/server.py", line 3, in <module>
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/aiohttp_jinja2/__init__.py", line 8, in <module>
tanner_web      |     from .helpers import GLOBAL_HELPERS
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/aiohttp_jinja2/helpers.py", line 8, in <module>
tanner_web      |     @jinja2.contextfunction
tanner_web      | AttributeError: module 'jinja2' has no attribute 'contextfunction'
tanner_web exited with code 1

Jinja2 website says:

jinja2.contextfunction(_f_)[](https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.contextfunction "Permalink to this definition")

Pass the context as the first argument to the decorated function.

Deprecated since version 3.0: Will be removed in Jinja 3.1. Use [`pass_context()`](https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.pass_context "jinja2.pass_context") instead.

For this I changed the DockerFile to have extra line, since the docker file fetches from github instead of reading the local requirements.txt file.

tanner_web exited with code 1
tanner_web      | Traceback (most recent call last):
tanner_web      |   File "/opt/tanner/tanner-env/bin/tannerweb", line 4, in <module>
tanner_web      |     __import__('pkg_resources').run_script('Tanner==0.6.0', 'tannerweb')
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/pkg_resources/__init__.py", line 651, in run_script
tanner_web      |     self.require(requires)[0].run_script(script_name, ns)
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1455, in run_script
tanner_web      |     exec(script_code, namespace, namespace)
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/Tanner-0.6.0-py3.9.egg/EGG-INFO/scripts/tannerweb", line 4, in <module>
tanner_web      |     __import__('pkg_resources').run_script('Tanner==0.6.0', 'tannerweb')
tanner_web      |   File "<frozen zipimport>", line 259, in load_module
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/Tanner-0.6.0-py3.9.egg/tanner/web/server.py", line 3, in <module>
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/aiohttp_jinja2/__init__.py", line 4, in <module>
tanner_web      |     import jinja2
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/jinja2/__init__.py", line 12, in <module>
tanner_web      |     from .environment import Environment
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/jinja2/environment.py", line 25, in <module>
tanner_web      |     from .defaults import BLOCK_END_STRING
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/jinja2/defaults.py", line 3, in <module>
tanner_web      |     from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
tanner_web      |   File "/opt/tanner/tanner-env/lib/python3.9/site-packages/jinja2/filters.py", line 13, in <module>
tanner_web      |     from markupsafe import soft_unicode
tanner_web      | ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/tanner/tanner-env/lib/python3.9/site-packages/markupsafe/__init__.py)
tanner_web exited with code 1

So here we now have another dependency issue: For this too I specified a specific version, using which I am able to install and run tanner successfully over Docker. Request the maintainers to verify / crosscheck and hardcode the versions of the various pip packages and update the same in requirements.txt

I have added these lines locally in my docker file.

pip3 install --no-cache-dir jinja2==2.11.3 --force-reinstall && \
pip3 install --no-cache-dir MarkupSafe==2.0.1 --force-reinstall && \
nikAizuddin commented 2 years ago

I'm also having the same issues. Limiting Jinja2 to 2.x and MarkupSafe to 2.0.x fixed this issue