New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: cannot import name 'echo' from 'click' (unknown location) #2634
Comments
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 |
Looks like this is probably something to do with namespace packages (https://www.python.org/dev/peps/pep-0420/). |
Getting something similar in a GitHub Actions workflow running 3.7.12: Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.7.12/x64/bin/black", line 8, in <module>
sys.exit(patched_main())
File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/black/__init__.py", line 6606, in patched_main
patch_click()
File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/black/__init__.py", line 6595, in patch_click
from click import _unicodefun # type: ignore
ImportError: cannot import name '_unicodefun' from 'click' (/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/click/__init__.py) |
@arturomf94 you're using an old version of Black. |
"old" meaning more than 5 hours ago: https://github.com/psf/black/releases/tag/22.3.0 (For the curious, this is the PR: #2966) |
No, much older than that. |
Tbf, I think I am using and older one! I believe it's |
Hmm - ok, how old, then? I was just writing some workaround code which is checking the version of black a user is requesting and pinning the version of |
Any version before 22.3.0 will fail. I was just pointing out that @arturomf94 was running a much older version. |
I'm also having this error using pre-commit. pre-commit is using verison "21.12b0" so I will try the latest....
|
Changing to version 22.3.0 has solved the problem... thanks! |
Pinned on I think that change probably broke a lot of pipelines though :/ |
Just ran into the same issue on black via pre-commit. Moving to |
thanks for the almost live chat and solution. Save me from troubleshooting my environment. |
This was exactly my impression @JKCai, I just found this issue and we live debugged it together ahaha! Thanks everyone o/ |
thanks a lot! :D |
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. |
See also: psf/black#2634 Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
* Upgrade the required black version. See also: psf/black#2634 Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
Relevant issue: psf/black#2634
I'm using Python 3.8.9 with conda environment and resulted in this problem
I tried to installing click by
pip install click
but the problem still persistsThe text was updated successfully, but these errors were encountered: