Karan Singh

Code Never Lies, Comments Sometime Do !!

Build Your Own Jupyter Notebook Environment

| Comments

Jupyter Notebook

If there is just ONE gear to select to dive into the deep waters of Data Science and Machine Learning, then without a second thought, its Juypter Notebook. Its a open source project which supports live coding on over 40 languages with native integration to Big Data and Machine learning frameworks like Spark, TensorFlow etc.

Don’t believe me … checkout ready to use and free Jupyter Notebooks Here

Enough Talk …. Let’s Get To Work

  • Create a directory on Docker host machine also change ownership of that directory for UID 1000 Jupyter default user
1
2
mkdir /nvme/jupiter-notebook/datascience-notebook
chown 1000 /nvme/jupiter-notebook/datascience-notebook
  • Generate a password hash using python CLI
1
2
3
4
5
>>> from notebook.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:e82e6a7ab4f8:0f712ca0de41256805dc003dc2134e0ff70a58d8'
  • The magical docker one liner for Jupyter Notebook is
1
2
3
4
5
docker run --restart unless-stopped -d \
-p 8888:8888 \
-v /nvme/jupiter-notebook/datascience-notebook:/home/jovyan/work \
-e NB_UID=1000 -e NB_GID=100 --user root jupyter/datascience-notebook:latest start-notebook.sh  \
--NotebookApp.password='sha1:e82e6a7ab4f8:0f712ca0de41256805dc003dc2134e0ff70a58d8'

Note : Dont forget to change volume name (-v) and Notebook Password Hash

  • Once Docker container for JN is ready, point your browser to http://localhost:8888
  • Enter the password to start using Jupyter Notebook
  • After login, the first thing to do is to test, grab this sample notebook and upload that to your Jupyter Notebook environment.
  • The rest is just your creativity.

See you on Jupiter !! Have Fun

Comments