Importerror: Cannot Import Name 'Parametersource' from 'Click. Core'

I'm working on simple flask app, and I received this error

    from click.core import ParameterSource
ImportError: cannot import name 'ParameterSource' from 'click.core' (/usr/local/lib/python3.10/dist-packages/click/core.py)

I don't know why it's appearing, because everything was fine and then just...

Here are versions I use:

black 23.1.0
click 8.1.3
Flask 2.2.3
Python 3.10.6
pip 22.0.2

I've been searching for solution and found that many people can't deal with this problem, and the only advice I found, is that I have to update Click and black to the latest version, but I'm already using the latest version.

What should I do? I there any any way to not use Click at all?

UPDATE

Here is how full error looks like

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.10/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.10/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/home/diametr/.local/lib/python3.10/site-packages/flask/__init__.py", line 5, in <module>
    from .app import Flask as Flask
  File "/home/diametr/.local/lib/python3.10/site-packages/flask/app.py", line 34, in <module>
    from . import cli
  File "/home/diametr/.local/lib/python3.10/site-packages/flask/cli.py", line 15, in <module>
    from click.core import ParameterSource
ImportError: cannot import name 'ParameterSource' from 'click.core' (/usr/local/lib/python3.10/dist-packages/click/core.py)
6

5 Answers

Please try the following steps:

 pip uninstall black
 pip uninstall click
 pip install black
 pip install click
1

You can soft reboot your server. Use

sudo reboot

Created another environment and launched my notebook there, I was able to resolve it this way.

1

Please try the following steps:

sudo apt purge python3-click
pip install click
1

I met the problem as the same. But when I changed the current working directory the problem disapper. Perhasp the click call the PWD as the first calling routine.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest