No module named 'ipywidgets'

Yes, just run following code from Jupyter env

import sys
!conda install --yes --prefix {sys.prefix} ipywidgets

Others, if installing from Jupyter env, please run with --yes --prefix {sys.prefix} to make sure it lands in correct environment.
If using pip, do

!{sys.executable} -m pip install ipywidgets

Not adding these prefixes is very often not enough if ran from Jupyter notebook.

If you’re interested in more, you can read about it on https://biasandvariance.com/2019/02/07/importing-packages-in-jupyter-notebooks/ (yes, it’s mine, i wrote it because i saw many people having these struggles)

3 Likes