<p dir="ltr">On Nov 13, 2015 3:07 PM, "R. David Murray" <<a href="mailto:rdmurray@bitdance.com">rdmurray@bitdance.com</a>> wrote:<br>
><br>
> On Fri, 13 Nov 2015 12:09:28 -0800, Nathaniel Smith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br>
> > On Nov 13, 2015 12:00 PM, "Alexander Walters" <<a href="mailto:tritium-list@sdamon.com">tritium-list@sdamon.com</a>><br>
> > wrote:<br>
> > ><br>
> > > import pip<br>
> > > pip.install(PACKAGESPEC)<br>
> > ><br>
> > > something like that?<br>
> ><br>
> > This would be extremely handy if it could be made to work reliably... But<br>
> > I'm skeptical about whether it can be made to work reliably. Consider all<br>
> > the fun things that could happen once you start upgrading packages while<br>
> > python is running, and might e.g. have half of an upgraded package already<br>
> > loaded into memory. It's like the reloading problem but even more so.<br>
><br>
> If I remember correctly, this is something that R supports that I<br>
> thought was cool when I saw it. We could have a command analogous<br>
> to the 'help' command, so you wouldn't even have to do an explicit<br>
> import. But yeah, making it work may be hard.</p>
<p dir="ltr">Yeah, I've long used this in R and it really is awesome -- I wasn't kidding in the first sentence I wrote above :-). It leads to a really short frustration cycle:</p>
<p dir="ltr">>>> import somepkg<br>
error<br>
>>> install("somepkg")<br>
installing...done.<br>
>>> import somepkg<br>
:-)</p>
<p dir="ltr">But details of R's execution model make this easier to do. Maybe it could be supported for the special case of installing new packages with no upgrades?</p>
<p dir="ltr">A good way to environment with the possibilities would be to write a %pip magic for ipython:</p>
<p dir="ltr"><a href="http://ipython.readthedocs.org/en/stable/interactive/tutorial.html#magic-functions">http://ipython.readthedocs.org/en/stable/interactive/tutorial.html#magic-functions</a><br>
<a href="http://ipython.readthedocs.org/en/stable/config/custommagics.html">http://ipython.readthedocs.org/en/stable/config/custommagics.html</a></p>
<p dir="ltr">-n</p>