Got dependency issue with spacy and markupsafe
See original GitHub issueAfter this PR https://github.com/pytorch/benchmark/pull/1261 change https://github.com/pytorch/benchmark/commit/94078d9288ff99ef50557a3bd87970badbef0458#diff-fcf1c48cd82709b9bd6dc7881e2a425d15502a75925097be18583a7c6a0ffdafR5, while doing python install.py
, I got
root@f3b64780b5e8:/workspace/torch-benchmark/benchmark# python install.py
checking packages torch, torchvision, torchtext, torchaudio are installed...OK
checking out Git LFS files...OK
decompressing input tarball: tacotron2-minimal.tar.gz...OK
decompressing input tarball: LearningToPaint_inputs.tar.gz...OK
decompressing input tarball: Background_Matting_inputs.tar.gz...OK
decompressing input tarball: Super_SloMo_inputs.tar.gz...OK
decompressing input tarball: pytorch_stargan_inputs.tar.gz...OK
decompressing input tarball: coco2017-minimal.tar.gz...OK
decompressing input tarball: pytorch_CycleGAN_and_pix2pix_inputs.tar.gz...OK
decompressing input tarball: coco128.tar.gz...OK
decompressing input tarball: multi30k.tar.gz...OK
decompressing input tarball: speech_transformer_inputs.tar.gz...OK
running setup for /opt/pytorch/benchmark/torchbenchmark/models/BERT_pytorch...OK
running setup for /opt/pytorch/benchmark/torchbenchmark/models/Background_Matting...OK
running setup for /opt/pytorch/benchmark/torchbenchmark/models/DALLE2_pytorch...OK
running setup for /opt/pytorch/benchmark/torchbenchmark/models/LearningToPaint...OK
running setup for /opt/pytorch/benchmark/torchbenchmark/models/Super_SloMo...OK
running setup for /opt/pytorch/benchmark/torchbenchmark/models/alexnet...OK
running setup for /opt/pytorch/benchmark/torchbenchmark/models/attention_is_all_you_need_pytorch...FAIL
Error for /opt/pytorch/benchmark/torchbenchmark/models/attention_is_all_you_need_pytorch:
---------------------------------------------------------------------------
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Traceback (most recent call last):
File "/opt/conda/lib/python3.8/runpy.py", line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/opt/conda/lib/python3.8/runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/opt/conda/lib/python3.8/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/opt/conda/lib/python3.8/site-packages/spacy/__init__.py", line 15, in <module>
from .cli.info import info # noqa: F401
File "/opt/conda/lib/python3.8/site-packages/spacy/cli/__init__.py", line 17, in <module>
from .debug_diff import debug_diff # noqa: F401
File "/opt/conda/lib/python3.8/site-packages/spacy/cli/debug_diff.py", line 10, in <module>
from .init_config import init_config, Optimizations
File "/opt/conda/lib/python3.8/site-packages/spacy/cli/init_config.py", line 8, in <module>
from jinja2 import Template
File "/opt/conda/lib/python3.8/site-packages/jinja2/__init__.py", line 12, in <module>
from .environment import Environment
File "/opt/conda/lib/python3.8/site-packages/jinja2/environment.py", line 25, in <module>
from .defaults import BLOCK_END_STRING
File "/opt/conda/lib/python3.8/site-packages/jinja2/defaults.py", line 3, in <module>
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File "/opt/conda/lib/python3.8/site-packages/jinja2/filters.py", line 13, in <module>
from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/conda/lib/python3.8/site-packages/markupsafe/__init__.py)
Traceback (most recent call last):
File "install.py", line 22, in <module>
spacy_download('en_core_web_sm')
File "install.py", line 10, in spacy_download
subprocess.check_call([sys.executable, '-m', 'spacy', 'download', language])
File "/opt/conda/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/opt/conda/bin/python', '-m', 'spacy', 'download', 'en_core_web_sm']' returned non-zero exit status 1.
---------------------------------------------------------------------------
Traceback (most recent call last):
File "install.py", line 134, in <module>
raise RuntimeError("Failed to complete setup")
RuntimeError: Failed to complete setup
There is a similar issue https://github.com/aws/aws-sam-cli/issues/3661#issuecomment-1043965261.
My temporary workaround is to pin the package version markupsafe==2.0.1
like this
https://github.com/xwang233/benchmark/commit/3dcf675debbe5a6d55e23e15c95be9618fbf620c
cc @xuzhao9
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
cannot import name 'soft_unicode' from 'markupsafe' in ...
I'm building the sam project on github action and since the upgrade of sam-cli to 1.38.0, i'm getting following error when i build...
Read more >Pip Package dependency overriding specified version in ...
MarkupSafe is a package required by Jinja2 which in turn is required by Flask. I soon found out that downgrading MarkupSafe from version...
Read more >Re: Issue to add spacy package in a code environment
It looks like the spacy that you install by: pip install spacy. isn't compatible with the language model that you install after.
Read more >MarkupSafe
MarkupSafe implements a text object that escapes characters so it is safe to use in HTML and XML. Characters that have special meanings...
Read more >cannot import name soft_unicode from markupsafe (Solved)
In some of the versions for markupsafe package, we get incompatibility with aws-sam-cli module. The best way to fix this issue is either...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @xuzhao9 , I won’t submit a PR about this since it’s not an upstream issue but actually an issue in our environment. I’ll fix our environment instead.
@xwang233 imo we should pin
jinja2
version here instead of markupsafe version. I can review a PR on that.