<br><br>On Sunday, October 29, 2017, Paul Moore <<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 29 October 2017 at 10:40, Stephan Houben <<a href="javascript:;" onclick="_e(event, 'cvml', 'stephanh42@gmail.com')">stephanh42@gmail.com</a>> wrote:<br>
> Perhaps slightly off-topic, but I have sometimes wondered if<br>
> pip could not be made somewhat friendlier for the absolute newbie<br>
> and the classroom context.<br>
><br>
> Some concrete proposals.<br>
><br>
> 1. Add a function `pip` to the interactive interpreter<br>
> (similar to how `help` is available).<br>
><br>
> def pip(args):<br>
> import sys<br>
> import subprocess<br>
> subprocess.check_call([sys.<wbr>executable, "-m", "pip"] + args.split())<br>
><br>
> This allows people to install something using pip as long as they have a<br>
> Python prompt open, and avoids instructors to have to deal with<br>
> platform-specific<br>
> instructions for various shells. Also avoids confusion when multiple<br>
> Python interpreters<br>
> are available (it operates in the context of the current interpreter.)<br>
<br>
There are subtle issues around whether newly installed/upgraded<br>
packages are visible in a running Python interpreter. </blockquote><div><br></div><div>If the package is already imported, reload() isn't sufficient; but deepreload from IPython may be.</div><div><br></div><div>IPython also supports shell commands prefixed with '!':</div><div><br></div><div>! pip install -U requests regex IPython</div><div>! pip install -U --user psfblessedset1</div><div>%run pip install -U --user psfblessedset1<br></div><div>%run?</div><div><br></div><div>% autoreload?</div><div># <a href="http://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html">http://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html</a></div><div><br></div><div>This:</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It's possible<br>
that this would result in *more* confusion than the current situation.</blockquote><div> </div><div>Why isn't it upgrading over top of the preinstalled set?</div><div><br></div><div>At least with bash, the shell command history is logged to .bash_history by default. IMO, it's easier to assume that environment-modifying commands are logged in the shell log; and that running a ``%logstart -o logged-cmds.py`` won't change the versions of packages it builds upon.</div><div><br></div><div>Is it bad form to put ``! pip install -U requests `` at the top of every jupyter notebook?</div><div>``! pip install requests==version `` is definitely more reproducible. (seeAlso: binder, jupyter/docker-stacks)</div><div><br></div><div>I'll just include these here unnecessarily from the other curated package set discussions:</div><div><br></div><div><a href="https://github.com/jupyter/docker-stacks">https://github.com/jupyter/docker-stacks</a><br></div><div><br></div><div><a href="https://github.com/Kaggle/docker-python/blob/master/Dockerfile">https://github.com/Kaggle/docker-python/blob/master/Dockerfile</a><br></div><div><br></div><div><a href="https://binderhub.readthedocs.io/en/latest/">https://binderhub.readthedocs.io/en/latest/</a><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I can see the appeal of something like this, but it's not as simple as<br>
it looks. If you want to discuss this further, I'd definitely suggest<br>
making it a thread of its own.</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Personally, as a pip maintainer, I'm -0<br>
on this (possibly even -1).</blockquote><div><br></div><div>Same.</div>