mlops-with-vertex-ai icon indicating copy to clipboard operation
mlops-with-vertex-ai copied to clipboard

Python markupsafe dependency error in 03-training-formalization.ipynb

Open hilliao opened this issue 2 years ago • 0 comments

The latest Python 3 package markupsafe is not compatible with from tfx.orchestration.experimental.interactive.interactive_context import InteractiveContext:

import ml_metadata as mlmd
from ml_metadata.proto import metadata_store_pb2
from tfx.orchestration.experimental.interactive.interactive_context import InteractiveContext

Error:

ImportError Traceback (most recent call last) /tmp/ipykernel_1/3645963042.py in 1 import ml_metadata as mlmd 2 from ml_metadata.proto import metadata_store_pb2 ----> 3 from tfx.orchestration.experimental.interactive.interactive_context import InteractiveContext 4 5 connection_config = metadata_store_pb2.ConnectionConfig()

~/.local/lib/python3.7/site-packages/tfx/orchestration/experimental/interactive/interactive_context.py in 35 36 import absl ---> 37 import jinja2 38 import nbformat 39 from tfx import types

~/.local/lib/python3.7/site-packages/jinja2/init.py in 10 from .bccache import FileSystemBytecodeCache 11 from .bccache import MemcachedBytecodeCache ---> 12 from .environment import Environment 13 from .environment import Template 14 from .exceptions import TemplateAssertionError

~/.local/lib/python3.7/site-packages/jinja2/environment.py in 23 from .compiler import CodeGenerator 24 from .compiler import generate ---> 25 from .defaults import BLOCK_END_STRING 26 from .defaults import BLOCK_START_STRING 27 from .defaults import COMMENT_END_STRING

~/.local/lib/python3.7/site-packages/jinja2/defaults.py in 1 # -- coding: utf-8 -- 2 from ._compat import range_type ----> 3 from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401 4 from .tests import TESTS as DEFAULT_TESTS # noqa: F401 5 from .utils import Cycler

~/.local/lib/python3.7/site-packages/jinja2/filters.py in 11 from markupsafe import escape 12 from markupsafe import Markup ---> 13 from markupsafe import soft_unicode 14 15 from ._compat import abc

ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/home/jupyter/.local/lib/python3.7/site-packages/markupsafe/init.py)

The workaround is to install an older version by pip install markupsafe==2.0.1 and restart kernel

hilliao avatar Jun 23 '22 04:06 hilliao