I often use Jupyter Notebooks, usually from within the (default) web browser interface, though I’ve been increasingly liking the direction that PyCharm’s interface has been going (e.g., see the feature page: https://www.jetbrains.com/pycharm/features/scientific_tools.html).
One of the problems I regularly encounter, however, is that some package (e.g., pandas) is not installed on whichever virtual environment I’m using. This requires installing the package with pip and then restarting the current notebook’s kernel, re-running whichever cells I’d already run.
Well, it turns out that this is usually not required. I ran into this post which provides a solution within the notebook itself:
import sys
!{sys.executable} -m pip install <package>
Trying this out:

This only needs to be run once, but it doesn’t necessarily hurt to leave it in (though probably better NOT to rely on this for package requirements, use a requirements.txt):
