Python in terminal finds module, jupyter notebook does not

@Khosravigashtasb’s advice is outdated in regards to installations.
Inside a Jupyter notebook, use the following in a cell.:

%pip install <module_name>

This installation is now a special Jupyter magic command meant to handle installing to exactly running the current notebook. A similar version of this magic command now works with conda too. Use %conda install as the start of a conda install command.

For more about this see here and discussion here.


@Khosravigashtasb is correct that typically an exclamation point before a general Unix or command line command is indeed a standard Jupyter method. However, in this case it is not a best practice as a better alternative now exists. Additionally, several common Unix-style commands such as ls and pwd don’t require the exclamation point.

1 Like