Skip to content
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 '_unicodefun' from 'click' #2225

Closed
karthiknadig opened this issue Mar 28, 2022 · 8 comments
Closed

ImportError: cannot import name '_unicodefun' from 'click' #2225

karthiknadig opened this issue Mar 28, 2022 · 8 comments

Comments

@karthiknadig
Copy link

karthiknadig commented Mar 28, 2022

Environment:

  • Python version: 3.10.2
  • Click version: 8.1.0

This used to work fine with previous version, now I get this error when running tools like black:

ImportError: cannot import name '_unicodefun' from 'click' (/lib/python3.10/site-packages/click/__init__.py)
@davidism
Copy link
Member

davidism commented Mar 28, 2022

This internal module is no longer needed for any supported version of Python, and has been removed.

If a project was importing this, usually to disable it, they can either set their minimum version to Click>=8.1.0, or they can use try/except ImportError to conditionally import it. Black 22.3.0 has already been released to address this.

@karthiknadig
Copy link
Author

when will the fixed version be out?

@ThiefMaster
Copy link
Member

ThiefMaster commented Mar 28, 2022

https://github.com/psf/black/blob/f239d227c003c52126239e1b9a37c36c2b2b8305/src/black/__init__.py#L1430-L1434

Looks like you just need to use a recent black version.

For the future: If you get an exception, include the traceback as well.

@Sillocan
Copy link

@karthiknadig This is an issue with black, not with click. psf/black#2964

@karthiknadig
Copy link
Author

@Sillocan Thanks for info and Sorry for missing the details on this.

altendky added a commit to Chia-Network/chia-blockchain that referenced this issue Mar 28, 2022
pallets/click#2225

Doing this instead of updating since updating black will change several
files due to some formatting change.  I would like to take that on
separately from unbreaking CI.
wjblanke pushed a commit to Chia-Network/chia-blockchain that referenced this issue Mar 29, 2022
pallets/click#2225

Doing this instead of updating since updating black will change several
files due to some formatting change.  I would like to take that on
separately from unbreaking CI.
altendky added a commit to Chia-Network/chia-blockchain that referenced this issue Mar 29, 2022
pallets/click#2225

Doing this instead of updating since updating black will change several
files due to some formatting change.  I would like to take that on
separately from unbreaking CI.
@arogozhnikov

This comment was marked as off-topic.

@ThiefMaster
Copy link
Member

A module starting with an underscore was always internal and never meant to be relied upon / used by anyone else. so while you may have a strong opinion about removing/deprecating anything that was part of a public API, this certainly cannot applied to _unicodefun...

@arogozhnikov

This comment was marked as off-topic.

wallentx pushed a commit to Chia-Network/chia-blockchain that referenced this issue Apr 1, 2022
pallets/click#2225

Doing this instead of updating since updating black will change several
files due to some formatting change.  I would like to take that on
separately from unbreaking CI.
altendky added a commit to Chia-Network/chia-blockchain that referenced this issue Apr 1, 2022
pallets/click#2225

Doing this instead of updating since updating black will change several
files due to some formatting change.  I would like to take that on
separately from unbreaking CI.
altendky added a commit to Chia-Network/chia-blockchain that referenced this issue Apr 2, 2022
pallets/click#2225

Doing this instead of updating since updating black will change several
files due to some formatting change.  I would like to take that on
separately from unbreaking CI.
br3ndonland added a commit to br3ndonland/inboard that referenced this issue Apr 2, 2022
pallets/click#2225
psf/black#2964

Black 22.1.0 raises an error when used with pre-commit:
`ImportError: cannot import name '_unicodefun' from 'click'`.
Black 22.3.0 resolves the `ImportError`.
br3ndonland added a commit to br3ndonland/fastenv that referenced this issue Apr 4, 2022
https://black.readthedocs.io/en/stable/change_log.html
pallets/click#2225
psf/black#2964

Black was raising an error when used with pre-commit:
`ImportError: cannot import name '_unicodefun' from 'click'`.
Black 22.3.0 resolves the `ImportError`.
wjblanke pushed a commit to Chia-Network/chia-blockchain that referenced this issue Apr 5, 2022
pallets/click#2225

Doing this instead of updating since updating black will change several
files due to some formatting change.  I would like to take that on
separately from unbreaking CI.
wjblanke pushed a commit to Chia-Network/chia-blockchain that referenced this issue Apr 8, 2022
* Updating changelog

* Update appdmg to 0.6.4 to work with macos 12.3 (#10886)

* restrict click to < 8.1 for black

pallets/click#2225

Doing this instead of updating since updating black will change several
files due to some formatting change.  I would like to take that on
separately from unbreaking CI.

* Check for vulnerable openssl (#10988)

* Check for vulnerable openssl

* Update OpenSSL on MacOS

* First attempt - openssl Ubuntu 18.04 and 20.04

* place local/bin ahead in PATH

* specify install openssl

* correct path

* run ldconfig

* stop building and check for patched openssl

* spell sudo right by removing it

* Remove openssl building - 1st attempt RHs

* Test Windows OpenSSL version HT @AmineKhaldi

* Get updated openssl version (#10991)

* Get updated openssl version

* Update pyinstaller

* Fix typo

* lets try this

* Let's try this

* Try this

Co-authored-by: Earle Lowe <[email protected]>

* Gh 1.3.3v2 (#11011)

* Non Hobo patch the winstaller for CVE-2022-0778 (#10995)

* install.sh is not upgrading OpenSSL on MacOS (#11003)

* MacOS isn't updating OpenSSL in install.sh

* Exit if no brew on MacOS

* Code the if tree like a pro instead.

Co-authored-by: Kyle Altendorf <[email protected]>

Co-authored-by: Kyle Altendorf <[email protected]>

* Remove hobo patch

* apt show not needed (#10997)

* install/upgrade openssl on Arch Linux also

* Update CHANGELOG

* revert Arch change backport

Co-authored-by: Kyle Altendorf <[email protected]>

Co-authored-by: wallentx <[email protected]>
Co-authored-by: Chris Marslender <[email protected]>
Co-authored-by: Gene Hoffman <[email protected]>
Co-authored-by: William Allen <[email protected]>
Co-authored-by: Earle Lowe <[email protected]>
br3ndonland added a commit to br3ndonland/fastenv that referenced this issue Apr 9, 2022
https://black.readthedocs.io/en/stable/change_log.html
pallets/click#2225
psf/black#2964

Black was raising an error when used with pre-commit:
`ImportError: cannot import name '_unicodefun' from 'click'`.
Black 22.3.0 resolves the `ImportError`.
yutanakamura-tky added a commit to yutanakamura-tky/template that referenced this issue Apr 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2022
Bobronium added a commit to Bobronium/cleo that referenced this issue May 22, 2022
branchvincent added a commit to python-poetry/cleo that referenced this issue May 27, 2022
* Update black

This fixes pallets/click#2225

* Update black and python version
Python version is updated to satisfy black constraint

The current project's Python requirement (>=3.6,<4.0) is not compatible with some of the required packages Python requirement:
    - black requires Python >=3.6.2, so it will not be satisfied for Python >=3.6,<3.6.2

* Reformat files with black 22.3.0

* Remove black from pyproject.toml

Co-authored-by: Branch Vincent <[email protected]>

* Revert updating python version

Co-authored-by: Branch Vincent <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants