black: ImportError: cannot import name 'echo' from 'click' (unknown location)
I’m using Python 3.8.9 with conda environment and resulted in this problem
Traceback (most recent call last):
File "/Users/mac/opt/anaconda3/bin/black", line 5, in <module>
from black import patched_main
File "/Users/mac/opt/anaconda3/lib/python3.8/site-packages/black/__init__.py", line 46, in <module>
from black.concurrency import cancel, shutdown, maybe_install_uvloop
File "/Users/mac/opt/anaconda3/lib/python3.8/site-packages/black/concurrency.py", line 6, in <module>
from black.output import err
File "/Users/mac/opt/anaconda3/lib/python3.8/site-packages/black/output.py", line 11, in <module>
from click import echo, style
ImportError: cannot import name 'echo' from 'click' (unknown location)
I tried to installing click by pip install click but the problem still persists
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 17
Commits related to this issue
- Upgrade the required black version. See also: https://github.com/psf/black/issues/2634 Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com> — committed to sighingnow/GraphScope by sighingnow 2 years ago
- Upgrade the required black version. (#1422) * Upgrade the required black version. See also: https://github.com/psf/black/issues/2634 Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com> — committed to alibaba/GraphScope by sighingnow 2 years ago
- bump black version due to fail in lyting py3.8 https://github.com/psf/black/issues/2634 — committed to GRAAL-Research/deepparse by davebulaval 2 years ago
- update "black" dependency as it was breaking on its own dependencies This issue: https://github.com/psf/black/issues/2634 — committed to imrehg/faculty by imrehg 2 years ago
- fix issue with older black release and click Relevant issue: https://github.com/psf/black/issues/2634 — committed to imrehg/faculty-cli by imrehg 2 years ago
Getting something similar in a GitHub Actions workflow running 3.7.12:
I don’t know how everyone ended up on this unrelated issue but glad it helped 😃 For the record, #2964 was where we tracked this bug.
“old” meaning more than 5 hours ago:
https://github.com/psf/black/releases/tag/22.3.0
(For the curious, this is the PR: https://github.com/psf/black/pull/2966)
thanks for the almost live chat and solution. Save me from troubleshooting my environment.
Any version before 22.3.0 will fail. I was just pointing out that @arturomf94 was running a much older version.
Tbf, I think I am using and older one! I believe it’s
black==20.8b1.Hello!
It’s almost impossible to diagnose the issue without more information as especially this is an issue with the click library. As far as I can tell the echo function has existed under the click namespace for years. What version of click are you running? You might also want to upgrade / force-reinstall click via
--upgrade/--force-reinstallpip install flags.