CAMI-challenge / AMBER

AMBER: Assessment of Metagenome BinnERs
https://cami-challenge.github.io/AMBER/
GNU General Public License v3.0
28 stars 7 forks source link

ImportError: cannot import name 'Markup' from 'jinja2' #49

Closed eparisis closed 1 year ago

eparisis commented 1 year ago

Hi there, I ran AMBER some days prior, and since then I updated some packages to run CAMISIM since some of them were incompatible and I cant get it to run anymore.

I get the following error message:

Traceback (most recent call last):
  File "/Users/eparisis/miniconda3/envs/amber/bin/amber.py", line 26, in <module>
    from src import amber_html
  File "/Users/eparisis/miniconda3/envs/amber/lib/python3.7/site-packages/src/amber_html.py", line 41, in <module>
    from bokeh.plotting import figure
  File "/Users/eparisis/miniconda3/envs/amber/lib/python3.7/site-packages/bokeh/plotting/__init__.py", line 2, in <module>
    from ..document import Document; Document
  File "/Users/eparisis/miniconda3/envs/amber/lib/python3.7/site-packages/bokeh/document/__init__.py", line 7, in <module>
    from .document import Document ; Document
  File "/Users/eparisis/miniconda3/envs/amber/lib/python3.7/site-packages/bokeh/document/document.py", line 35, in <module>
    from ..core.templates import FILE
  File "/Users/eparisis/miniconda3/envs/amber/lib/python3.7/site-packages/bokeh/core/templates.py", line 20, in <module>
    from jinja2 import Environment, Markup, FileSystemLoader, PackageLoader
ImportError: cannot import name 'Markup' from 'jinja2' (/Users/eparisis/miniconda3/envs/amber/lib/python3.7/site-packages/jinja2/__init__.py)

I get this same error message running it on Linux and on my local Mac. Installing it from scratch in a new conda env also produces this error.

I've looked up some fixes for jinja2 but nothing worked.

Trying to build the docker image as in the instruction also didn't work:

$ docker build -t amber:latest .
Sending build context to Docker daemon   74.1MB
Step 1/10 : FROM python:3.7-slim
3.7-slim: Pulling from library/python
3f4ca61aafcd: Pull complete 
3f487a3359db: Pull complete 
e87858cc8912: Pull complete 
471900aadde7: Pull complete 
37bdaa58825f: Pull complete 
Digest: sha256:62209b7fcd75e157220c682de6c81e737a3d36a06ce05f449757c7b9ef271f99
Status: Downloaded newer image for python:3.7-slim
 ---> 74e5f3c48333
Step 2/10 : ADD image /usr/local
 ---> efb47449e5cb
Step 3/10 : ADD *.py /usr/local/bin/
 ---> ce875502bb87
Step 4/10 : ADD src /usr/local/bin/src
 ---> c663e9a0e4ef
Step 5/10 : ADD src/utils /usr/local/bin/src/utils
 ---> 2b80cb51a18f
Step 6/10 : ADD requirements /requirements
failed to export image: failed to create image: failed to get layer sha256:3da0f9e1caa5774c47974ea1948ca723ac5a3fad7bebeaeb513002f3ca3cabc4: layer does not exist

The packages versions in the requirements.txt are all installed so I don't know whats wrong.

yazhinia commented 1 year ago

Hi, I also faced this issue and could solve it by removing the jinja2 package separately and reinstalling it with version 3.0 instead of 3.1.1. I used virtual environment to install amber using Virtualenv. Hope it works for you as well. pip3 install Jinja2==3.0

Best, Yazhini

eparisis commented 1 year ago

Hey @yazhinia thanks a lot.

I tried different versions of jinja in the conda env I installed AMBER and finally got it to work with pip install jinja2==3.0.1.