Most likely because the Jupyter notebook isn’t using the same Python kernel.
You can select the Python kernel inside the notebook to make sure you are using the same, which is called in your terminal.
Also, a bit unrelated, but I personally prefer to create conda environments to avoid these conflicts.