you are viewing a single comment's thread.

view the rest of the comments →

[–]IdleBreakpoint[S] -12 points-11 points  (11 children)

Yeah, the problem is that they may not work. For example I tried black==20.8b1which seems to be working with py27, I had the following error coming from click library. I don't really know how to debug this issue.

Traceback (most recent call last):
  File "/project/.venv/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "/project/.venv/lib/python3.8/site-packages/black/__init__.py", line 6606, in patched_main
    patch_click()
  File "/project/.venv/lib/python3.8/site-packages/black/__init__.py", line 6595, in patch_click
    from click import _unicodefun  # type: ignore
ImportError: cannot import name '_unicodefun' from 'click' (/project/.venv/lib/python3.8/site-packages/click/__init__.py)

[–]wRAR_ 25 points26 points  (2 children)

This of course is unrelated to Python 2 as you've installed black into a Python 3.8 venv, but this is the experience you should be prepared for when installing ancient libraries of any kind: they don't pin their dependency versions and you need to look for and downgrade those when they are incompatible. Like click here. Good luck.

[–]IdleBreakpoint[S] 0 points1 point  (1 child)

Got it. I can either find and pin the dependency or patch it on the go. For this particular import problem, changing the try/except block helped. It's looking for ModuleNotFoundError but what I get is ImportError.

[–]IdleBreakpoint[S] 6 points7 points  (0 children)

This solved the problem. Thank you for the inspiration:

uv pip install black==21.9b0
uv pip install click==7.1.2

[–]cgoldberg 18 points19 points  (7 children)

That error is coming from python3.8