mousepixels / sanbomics_scripts

scripts and notebooks from sanbomics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use better `pip install` approach in tutorials

fomightez opened this issue · comments

I ran across your tutorial here as part of looking into this Biostars post.

I don't know where you suggest people run this code; however, if it is in standard Jupyter, I'd suggest you update your examples of pip install to not include use of the exclamation point. For example, in that Jupyter notebook I referenced the fifth cell has an example. I would suggest you change it to %pip install scvi-tools. In the last few years the magic command %pip install (and related %conda install) were added to insure that when running pip install in Jupyter notebooks, the installation occurs in the environment that backs the notebook kernel. This is something the use of the exclamation point alone with pip install failed to do and caused all sorts of issues. You can read more about the modern %pip install and %conda install magic commands here.

Unfortunately, I think Google Colab derived their offshoot of the Jupyter interface before that happened, and so it isn't consistent. I'm not 100% sure about the Google Colab notebooks and what is best; however, for standard Jupyter use of the magic command is best. And so if you direct people using your stuff to Google Colab mostly, I can understand using the outdated syntax.

It's also good to be aware that because modern Jupyter installations most often have automagics enabled by default, pip install without any symbol will use the modern magic command behind the scenes, and so even no symbol is better than suggesting the exclamation point with pip install now. However, explicit is best for learners and future you.

commented

Thanks for the comment. You are right, I should start using %. I think I was just always used to using ! and actually never had an issue until just recently where I actually had to use %.