Installing Python Packages to Azure Notebooks

Published 03-21-2019 06:54 AM 2,643 Views
Microsoft
First published on MSDN on Sep 20, 2017


One of the key questions we get from academic around the use of Azure Notebooks http://notebooks.azure.com is that its critical that we know whether specific python packages can be made available to students.

The easy answer is yes and there are actually a couple of options for academics, so that you can ensure packages are available within your academic notebooks:

1. You can install them yourself within your notebook using the command "!pip install" in most cases just simply remember the ! command.



2. You can drop into the Terminal and install packages from the bash shell, via pip, conda, etc as you would do on your personal machine. see https://notebooks.azure.com/help If you do this in the library directory into a virtual environment, the installed bits will be there when students Clone that library - they have to activate that environment to use it.





3. There is now a "start-up" script called aznbsetup.sh that runs each time a container is started.   whatever pip, wget, etc. commands you put there will be run upon start-up of the notebook.  note that each container starts fresh.



For more details please see http://notebooks.azure.com HELP section
%3CLINGO-SUB%20id%3D%22lingo-sub-379371%22%20slang%3D%22en-US%22%3EInstalling%20Python%20Packages%20to%20Azure%20Notebooks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-379371%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Sep%2020%2C%202017%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F94998i5A3029C1D539FD25%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20One%20of%20the%20key%20questions%20we%20get%20from%20academic%20around%20the%20use%20of%20Azure%20Notebooks%20%3CA%20href%3D%22http%3A%2F%2Fnotebooks.azure.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20http%3A%2F%2Fnotebooks.azure.com%20%3C%2FA%3E%20is%20that%20its%20critical%20that%20we%20know%20whether%20specific%20python%20packages%20can%20be%20made%20available%20to%20students.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20The%20easy%20answer%20is%20yes%20and%20there%20are%20actually%20a%20couple%20of%20options%20for%20academics%2C%20so%20that%20you%20can%20ensure%20packages%20are%20available%20within%20your%20academic%20notebooks%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%201.%20You%20can%20install%20them%20yourself%20within%20your%20notebook%20using%20the%20command%20%22!pip%20install%22%20in%20most%20cases%20just%20simply%20remember%20the%20!%20command.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F94999i946F0308059CBCA4%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%5B%23%24dp28%5D%3CBR%20%2F%3E%3CBR%20%2F%3E2.%20You%20can%20drop%20into%20the%20Terminal%20and%20install%20packages%20from%20the%20bash%20shell%2C%20via%20pip%2C%20conda%2C%20etc%20as%20you%20would%20do%20on%20your%20personal%20machine.%20see%20%3CA%20href%3D%22https%3A%2F%2Fnotebooks.azure.com%2Fhelp%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fnotebooks.azure.com%2Fhelp%20%3C%2FA%3E%20If%20you%20do%20this%20in%20the%20library%20directory%20into%20a%20virtual%20environment%2C%20the%20installed%20bits%20will%20be%20there%20when%20students%20Clone%20that%20library%20-%20they%20have%20to%20activate%20that%20environment%20to%20use%20it.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F95000iBA4F10AAE58BBB65%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F95001i5214F97CA00CEFF4%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E3.%20There%20is%20now%20a%20%22start-up%22%20script%20called%20aznbsetup.sh%20that%20runs%20each%20time%20a%20container%20is%20started.%26nbsp%3B%26nbsp%3B%20whatever%20pip%2C%20wget%2C%20etc.%20commands%20you%20put%20there%20will%20be%20run%20upon%20start-up%20of%20the%20notebook.%26nbsp%3B%20note%20that%20each%20container%20starts%20fresh.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F95002i8DFD8CB3EAD17C72%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20more%20details%20please%20see%20%3CA%20href%3D%22http%3A%2F%2Fnotebooks.azure.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20http%3A%2F%2Fnotebooks.azure.com%20%3C%2FA%3E%20HELP%20section%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-379371%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Sep%2020%2C%202017%20One%20of%20the%20key%20questions%20we%20get%20from%20academic%20around%20the%20use%20of%20Azure%20Notebooks%20http%3A%2F%2Fnotebooks.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-379371%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eacademic%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ecloud%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ecloud%20computing%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Efaculty%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ejupyter%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ejupyterhub%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ENotebooks%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EResearch%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Estudent%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Estudents%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Mar 21 2019 06:54 AM
Updated by: