Despite pip finds the package I can not import it in jupyter notebook - please see the screenshot that I've attached for the clarity. Describes the path to executable and the command prompt. Is something wrong with the kernel?
How can I fix this to use the redlines package in my kernel?
The commands you want to run in your running Jupyter .ipynb
file are:
%pip install redlines
Make a new cell and run that and then restart the kernel. (If it is a partcularly complex package sometimes you need to shut down all Jupyter and your browser and restart. And then wonce back in, do a hard browser refresh on the Jupyter notebook page. Some of the more complex installs involving controlling how things display, like ipympl
, need more than just restart the kernel. Packages like pandas
just needs restarting the kernel.)
And then to check that it installed to the correct environment, run in your notebook:
%pip list
The magic pip
command variation was added in 2019 to ensure the install occurs in the environment where the kernel is running that backs the active notebook.
The exclamation point doesn't do that and can lead to issues.
You should be also using %pip list
to see what is installed in the kernel that your notebook is using.
See more about the modern %pip install
command here. The second paragraph here goes into more details about why the exclamation point may lead to issues.