canary_in_the_data_mine
canary_in_the_data_mine

Reputation: 2393

Module not found when trying to run `black` in a Jupyter notebook

I've created a Jupyter notebook inside of a virtual environment.

These packages are installed:

black==22.12.0
jupyter~= 1.0.0
jupyter-black==0.3.3
jupyter-contrib-nbextensions~=0.5.1

In my notebook, there's a button with a little gavel to run black code formatting. However, when I click this, I get the error message:

localhost:8888 says 

[jupyter-black]
 Error:ModuleNotFoundError
No module named 'black'

I've made sure I'm using the kernel created inside this virtual environment.

Reading through the docs has not pointed out any obvious errors I'm making here. Any suggestions on getting black to run appropriately?

Upvotes: 0

Views: 1784

Answers (1)

canary_in_the_data_mine
canary_in_the_data_mine

Reputation: 2393

Run something like the answer here:

python -m ipykernel install --name=my-virtualenv-name

Upvotes: 1

Related Questions