The “ImportError: cannot import name ‘ParameterSource’ from ‘click.core‘” occurs when we have an outdated version of the click module.
To solve the error, upgrade your versions of the click and black modules.
Common Causes of cannot import name ‘parametersource’ from ‘click.core’
Now we already the main cause of this error which is an outdated version, nevertheless…
Here are other reasons that can help you in troubleshooting the error.
- The parametersource module was added in version 8.0 of the Click package. So, if you are using an older version of Click, you may encounter this error.
- Besides that, if you have a module or package in your project that is named click, it can cause a name conflict with the actual click package.
- Also if you have circular imports in your project it can cause the parametersource module to be imported before it is defined.
- If you have a file in your project that is named click.py, it can prevent the actual click package from being imported correctly.
- Finally, if the click package has some dependencies, such as colorama and typing_extensions this lead to incorrect import.
Importerror: cannot import name ‘parametersource’ from ‘click.core’ – Solutions
Now that we already the causes and how this error occurs, try the given solutions to fix the error.
Upgrade version of the black module
Since the common cause of the error is due to outdated version of the black module that has the click module as a dependency…
Therefore the first thing you should try is to upgrade your version of the black module.
pip install black --upgrade
pip3 install black --upgrade
📌 # if you don't have pip in PATH environment variable
python -m pip install black --upgrade
python3 -m pip install black --upgrade
📌# When using py alias (Windows)
py -m pip install black --upgrade
📌# When using Jupyter Notebook
!pip install black --upgrade
When the given command does not work, I suggest upgrading the click module as well.
pip install click --upgrade
pip3 install click --upgrade
📌# if you don't have pip in PATH environment variable
python -m pip install click --upgrade
python3 -m pip install click --upgrade
📌# py alias (Windows)
py -m pip install click --upgrade
📌# In case you're using Jupyter Notebook
!pip install click --upgradeReinstall the black and click modules
When the error still continues try to uninstall and install again the black and click modules.
pip uninstall black click -y
pip3 uninstall black click -y
pip install black click
pip3 install black click
Meanwhile if none of this works, I suggest upgrading all the packages in the environment.
Upgrade all packages in your environment
This time using Python script is the easiest way to upgrade all outdated packages.
You can store the script in a Python file, for instance main.py, and run the file with Python main.py to upgrade all of the outdated packages.
import pkg_resources
from subprocess import call
packages = [dist.project_name for dist in pkg_resources.working_set]
call("pip install --upgrade " + ' '.join(packages), shell=True)
Meanwhile, you can use alternative commands in upgrading all outdated packages.
#📌 macOS or Linux
pip install -U `pip list --outdated | awk 'NR>2 {print $1}'`
#📌 Windows
for /F "delims= " %i in ('pip list --outdated') do pip install -U %i
If you use a requirements.txt file, you can update it with the following command.
pip freeze > requirements.txtAnyway here are the fixed errors that can help you in case you encounter these issues.
- importerror html5lib not found please install it
- Importerror: cannot import name ‘joblib’ from ‘sklearn.externals’
Conclusion
In conclusion, Importerror: cannot import name ‘parametersource’ from ‘click.core‘ occurs when we have an outdated version of the click module.
The most straightforward way to fix the error is to update the outdated version of click and black module.
I thank that’s all for this error. I hope this article has helped you fix it.
Until next time! 😊
Frequently Asked Questions
What is Python ImportError and what causes it?
ImportError is raised when an import fails for any reason. The most specific subtype is ModuleNotFoundError (no such module). Plain ImportError typically means the module exists but a name inside it can’t be imported, e.g. ‘cannot import name X from Y’ (X was renamed, removed, or moved between versions of Y). Common with library version mismatches.
How do I fix ‘cannot import name X from Y’?
Three steps: (1) Check the library version: pip show Y. (2) Check the changelog of Y, X may have been renamed or removed in a recent release. (3) Either pin to an older Y version (pip install Y==1.x.y) or update your code to the new import path. Common 2025-2026 examples: Werkzeug url_decode removed, Pillow ANTIALIAS renamed to LANCZOS.
Why does the import work in REPL but fail in script?
Two reasons. (1) Different Python interpreter: REPL uses one Python, your script uses another. Run python –version both times. (2) Different working directory: REPL is started where you have access to local modules, script is run from a different cwd. Add the project path to sys.path or use python -m to run as a module.
How do I avoid circular import errors?
Circular imports happen when module A imports B and B imports A at the top level. Three fixes: (1) Move one import inside the function that uses it (lazy import). (2) Restructure code so A and B both import from a third module C. (3) Use TYPE_CHECKING for type-hint-only imports: if TYPE_CHECKING: from a import X.
Where can I find more ImportError fixes?
Browse the ImportError reference hub for 67+ specific fixes (Flask, Werkzeug, Django, ML library versions). For missing-module cases see ModuleNotFoundError. For Python setup help see Python Tutorial hub.
