admin管理员组文章数量:1123051
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?
Screenshot from the situation
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?
Screenshot from the situation
Share Improve this question edited 3 hours ago Miick asked 3 hours ago MiickMiick 32 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 1The 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.
本文标签: Can39t import python package to jupyter notebookStack Overflow
版权声明:本文标题:Can't import python package to jupyter notebook - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736545449a1944440.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
pip
viapython -m pip
. If funk stuff is happening in Jupyter, I always restart the kernel. Not saying these are solutions, but something to try. – JonSG Commented 3 hours ago%pip
, e.g.,%pip list
to target things being run in notebook to the environment the kernel is running. The exclamation point does not do this. A lot of outdated material suggests an exclamation point with installs when it should be%pip install
these days in modern Jupyter. This is nearly universal now, including working with JupyterLite and Google Colab. ... – Wayne Commented 3 hours ago%pip
command here. – Wayne Commented 3 hours ago