<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Jake, <div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 16, 2015, at 14:49, Jacob Vanderplas <<a href="mailto:jakevdp@cs.washington.edu" class="">jakevdp@cs.washington.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi folks,</div><div class="">One quick question – in previous IPython versions, I had often used ``!pip install`` commands from within the notebook to make sure packages are installed before importing them. I've noticed that in newer versions of the notebook this doesn't work – the kernel and the shell are not necessarily in sync: it seems that pip is by default tied to the python version which ran ``jupyter notebook``, rather than the Python version running the kernel.</div><div class=""><br class=""></div><div class="">Is there anything I can do to make pip work in the notebook again? Thanks!<br class=""></div></div></div></blockquote><div><br class=""></div><div>a quick way would be the following: </div><div><div><br class=""></div><div>```</div><div>import sys</div><div>!{sys.executable} -m pip ...</div><div>```</div><div><br class=""></div><div>or make use of some magics: </div><div><br class=""></div><div><div><a href="https://pypi.python.org/pypi/pip_magic" class="">https://pypi.python.org/pypi/pip_magic</a>   (don’t even need the ! anymore, just import it :-)</div></div></div><div><br class=""></div><div><br class=""></div><div>Won't work with conda though, unless you mess with the kernel spec to export PATH correctly to be in your envs,</div><div>So that any shelling out use conda executables executables instead of systems ones. Kind of a manual “source activate” step. </div><div>I know that some people are working on Conda Kernels Launchers to automatize that.</div><div><br class=""></div><div>Happy Coding. </div><div><br class=""></div><div>-- </div><div>M</div><div><br class=""></div></div></div></body></html>