I created a virtual environment called "fastai" by conda. I tried to install ipywidgets in it by
mamba install ipywidgets
Then I checked it and it did exist. But when I used
jupyter --version
I found the status of ipywidgets was "Not installed". I guessed it might be the problem of jupyter kernel, and I registered a kernel for my virtual environment fastai:
python -m ipykernel install --user --name fastai --display-name "Python (fastai)"
I checked the new kernel by
jupyter kernelspec list
and it did succeed. Then I opened a notebook by
jupyter notebook
and shifted the kernel to the one I created with my virtual env fastai. But I stilled failed to import ipywidgets in the notebook. What's more,
jupyter --version
also kept that ipywidgets could not be found. I checked my widgetsnbextension, but found both the base env and the virtual env had already had it. That's what I got in my Powershell. I wonder what's going on, and how I can use ipywidgets in my virtual env successfully.
.ipynbfile. Especially since you say you successfully "shifted the kernel to the one I created with my virtual env fastai". So do that again and this time in the notebook try running%conda install conda-forge::ipywidgets, based on here. (Magic symbol is important.) That probably won't work though since conda is particular unless you are running this on a remote machine that may allow this process to work. ...conda/mambawhen possible since you mentioning that means you choose it as primary package manager. I should have said this earlier, where you were successful at shifting the kernel, did you refresh the page you were trying to work on? ipywidgets does a lot of stuff in the page and so if you don't do a hard browser refresh first, you sometimes can fool yourself. So I suggest trying that first. Shift your kernel to the one you created and restart the kernel and then do a hard browser refresh. On a Mac in ...Commad + SHIFT + rto do a hard refresh. Only after all that can you try ipywidgets. Now back to installing from within the running.ipynbfile. If conda won't let you try the%conda install, and you really just want to get past this hurdle, you can try running in the active Jupyter cell after you shifted the kernel%pip install ipywidgets. Let that complete entirely and then restart the kernel and do a hard refresh on the browser page, and then even restart the browser and repeat that restart & refresh before trying ipywidgets.