jupyterlab_code_formatter
jupyterlab_code_formatter copied to clipboard
module 'black' has no attribute '__version__'
Checklist prior to opening an issue
- [ 1] I have followed fully the installation steps laid out in the documentation site.
- [ 1] I have restarted jupyterlab.
- [ 1] I have read the FAQ section in the documentation site.
Describe the bug
A clear and concise description of what the bug is.
When click the button, it shows "Jupyterlab Code Formatter Error, module 'black' has no attribute 'version'"

black version: 22.3 jupyterlab_code_formatter verison 1.4.11 JupyterLab version: 3.4.2
Diagnostic commands Please attach the output of the following commands (please format them properly)
-
pip freezeblack==22.3.0 jupyterlab-code-formatter==1.4.11 -
jupyter labextension listJupyterLab v3.4.2 /home/ruizhi/miniconda3/share/jupyter/labextensions jupyterlab-topbar-extension v0.6.1 enabled OK (python, jupyterlab-topbar) jupyterlab-system-monitor v0.8.0 enabled OK (python, jupyterlab-system-monitor) @ryantam626/jupyterlab_code_formatter v1.4.11 enabled OK (python, jupyterlab-code-formatter) @lckr/jupyterlab_variableinspector v3.0.9 enabled OK (python, lckr_jupyterlab_variableinspector) @jupyter-server/resource-usage v0.6.1 enabled OK (python, jupyter-resource-usage) @krassowski/jupyterlab-lsp v3.10.1 enabled OK (python, jupyterlab-lsp)
Other labextensions (built into JupyterLab) app dir: /home/ruizhi/miniconda3/share/jupyter/lab @jupyterlab/toc v5.4.2 enabled OK
jupyter serverextension listConfig optionkernel_spec_manager_classnot recognized byListServerExtensionsApp. config dir: /home/ruizhi/.jupyter jupyter_lsp disabled- Validating... jupyter_lsp 1.5.1 OK jupyter_kite disabled
- Validating... Error loading server extension jupyter_kite X is jupyter_kite importable? config dir: /home/ruizhi/miniconda3/etc/jupyter jupyter_lsp enabled
- Validating... jupyter_lsp 1.5.1 OK jupyter_resource_usage enabled
- Validating... jupyter_resource_usage 0.6.1 OK jupyterlab enabled
- Validating... jupyterlab 3.4.2 OK **jupyterlab_code_formatter enabled
- Validating... jupyterlab_code_formatter 1.4.11 OK**
Screenshots
If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.
Maybe the reason is the version of black packeg?
Update: degrade the version of black to 22.1.0 and it works. But it looks like it is a bug caused by the newest version of black. You should mention it or fix it :-)
That's weird.. I just tried it with black==22.3.0 and I can't replicate this, is this still an issue if you try again with 22.3.0?
That's weird.. I just tried it with
black==22.3.0and I can't replicate this, is this still an issue if you try again with22.3.0?
I was having the same issue today. Downgraded black and it resolved
Closing due to inactivity.