Jupyter lab notebook `No Module Named` error upon importing installed packages

For a better experience in modern Jupyter, you should shift to using the more current %pip install when attempting to do installations from inside a running Jupyter .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.

See more about the modern %pip install command here added in 2019 for a better experience with such installs performed from in a cell inside a running notebook. The second paragraph here goes into more details about why the exclamation point may lead to issues.

This likely will not have any effect in your current situation, yet it will pay dividends later going forward in your Jupyter experience wherever you use modern Jupyter as it works in JupyterLite and even Google Colab now.

3 Likes