This has not been the way since 2019. You should be using the magic version, %pip install
, inside a cell in a running notebook to do installs in an active running .ipynb
file. That ensures the commands target the environment where the kernel backing the notebook is running. The exclamation point used in conjunction with install commands doesn’t do that and so it may lead to unexpected outcomes.
Please, see here for more about this with links to related resources and documentation therein.