ERROR: ImportError: cannot import name 'specs' from partially initialized module 'pylatexenc.latexwalker._defaultspecs' (most likely due to a circular import)
jtplaarj opened this issue · 3 comments
jtplaarj commented
Betterbib is giving me an error about a circular import.
The steps to reproduce it are:
python3 -m venv .venv
source .venv/bin/activate
pip3 install betterbib
betterbib up bib.bib
The contents of the bib file seem irrelevant. An example from the documentation
@article {krylov,
author = {Liesen and Gaul and Nabben},
title = {Framework Deflation Krylov Augmented}
}
The full error is:
Traceback (most recent call last):
File "/tmp/.venv/bin/betterbib", line 8, in <module>
sys.exit(main())
File "/tmp/.venv/lib/python3.9/site-packages/betterbib/cli/_main.py", line 67, in main
return args.func(args)
File "/tmp/.venv/lib/python3.9/site-packages/betterbib/cli/_update.py", line 26, in run
d = sync(
File "/tmp/.venv/lib/python3.9/site-packages/betterbib/sync.py", line 53, in sync
data = future.result()
File "/usr/lib/python3.9/concurrent/futures/_base.py", line 433, in result
return self.__get_result()
File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/tmp/.venv/lib/python3.9/site-packages/betterbib/crossref.py", line 171, in find_unique
payload = translator.latex_to_text(" ".join(L)).replace(" ", "+")
File "/tmp/.venv/lib/python3.9/site-packages/pylatexenc/latex2text/__init__.py", line 1022, in latex_to_text
latexwalker.LatexWalker(latex, **parse_flags).get_latex_nodes()[0]
File "/tmp/.venv/lib/python3.9/site-packages/pylatexenc/latexwalker/__init__.py", line 1174, in __init__
latex_context = get_default_latex_context_db()
File "/tmp/.venv/lib/python3.9/site-packages/pylatexenc/latexwalker/__init__.py", line 231, in get_default_latex_context_db
from ._defaultspecs import specs
ImportError: cannot import name 'specs' from partially initialized module 'pylatexenc.latexwalker._defaultspecs' (most likely due to a circular import) (/tmp/.venv/lib/python3.9/site-packages/pylatexenc/latexwalker/_defaultspecs.py)
nschloe commented
Yeah, pylatexenc is a flaky dependency. Doesn't seem to be maintained upstream. Will plug in something else soon.
nschloe commented
I just tried reproducing the issue but was unable to do so.
jtplaarj commented
True. The version giving the error was 4.2.0, with current version 4.3.3 everything seems OK.
Thanks!!!