Setting up a Data Science environment using Windows Subsystem for Linux (WSL) and Jupyter

if you enjoy this article and want to see more!First off we have to do some preliminary setup to get WSL working:1 — Turning on ‘Developer mode’First head to the developer settings in your Windows 10 settings menu: Settings ➡ Update & Security ➡ For developers ➡ Developer modeOr simply search for the term “dev” and click on “Developer settings”Here you might need to sign into an admin account or get temporary access to turn on the Developer mode:Once enabled we need to turn on the Windows Subsystem for Linux feature.

2 — Turning on ‘Windows Subsystem for Linux’This menu can be accessed as such by going to: Control Panel ➡ Programs ➡ Turn Windows features on and offOr simply search “windows features” and click on “Turn Windows features on or off”Next make sure the feature “Windows Subsystem for Linux” is ticked:3 — Restart your computer!4 — Installing UbuntuSimply head to the Microsoft Store and search for “Ubuntu”, select the App (ugh.

) you prefer and install it on your machine:When first launched you’ll be prompted to enter a UNIX username and password, choose whatever you see fit.

Congratulations, you now have a fully functional Linux Subsystem in which you have full admin rights!Personally I don’t really like the look of the default terminal so I would recommend following this to install ZSH and Oh-my-zsh if that’s your cup of tea:Setting up Windows Subsystem for Linux with zsh + oh-my-zsh + ConEmuThe era of .

NET developers being constrained on using only Windows as a platform is gone.

(At least for ASP.

NET).

That…blog.

joaograssi.

comSetting up Anaconda1 — Downloading AnacondaStart up your newly configured WSL and download Anaconda:wget https://repo.

anaconda.

com/archive/Anaconda3-2019.

03-Linux-x86_64.

sh2 — Installing AnacondaNext, execute the downloaded file to install Anaconda:Anaconda3-2019.

03-Linux-x86_64.

shNB: Use “bash Anaconda3–2019.

03-Linux-x86_64.

sh” if using ZSH and you’re running into problems.

After following the onscreen instructions to install Anaconda, simply remove the installation file:rm Anaconda3-2019.

03-Linux-x86_64.

sh3 — Updating AnacondaNow you should be able to start up your Anaconda environment:source ~anaconda3/bin/activate“~anaconda3/bin/activate” is default place that Anaconda will install itself but if you chose elsewhere simply point to that directory.

Once activated, initiate a full update:conda update –all4 — Done.

!Once updated, lean back and gaze upon your creation and see that it is good…You’ve successfully set up a Windows Subsystem for Linux with Anaconda 3!Setting up your Jupyter Notebook environmentThis is pretty straight forward since Jupyter is native to Anaconda, so if you’re happy with the default Jupyter Notebook interface / environment then you’re already done!.Simply launch a notebook by using the following command once you’ve activated your Anaconda environment:jupyter notebookThe WSL instance should automatically launch a window connected to the Notebook, but if that isn’t the case simply find the host address in the WSL terminal which looks something like this: “ http://localhost:8888/tree?token=someprettylongtokenhere” and copy that into your browser of choice.

Customising Jupyter NotebookI’ll go over two main ways you can customise your Jupyter Notebook experience, Nbextensions and Themes, jump to whatever section you find relevant to you.

1 — Setting up extensionsThankfully this is pretty easy as well, simply run the following command to set up the nbextensions package and restart your notebook:pip install jupyter_contrib_nbextensions && jupyter contrib nbextension installNext you’ll be presented by a new tab when you launch your notebooks called “Nbextensions”Now you can simply pick and chose what plugins you want / need and customise to your hearts content.

The interface also supplies you with a screenshot and description of each extension so you can gauge whether you want to enable it or not.

I specifically recommend the following:Hinterland — For easier auto-correction.

Table of Contents (2) — For automatically generating a ToC from your Markdown headings and sub-headings.

Toggle all line numbers — For easier debugging.

Variable Inspector — For an R-like variable overview, really useful!ExecuteTime — For timing your cell executions.

Autopep8 — For automatically formatting your code to pep8 standards.

Collapsible Headings — For easy hiding of parts of your notebook.

That’s it!.If you feel like this wasn’t enough to quench your interest in extensions I can highly recommend the following article on the same subject:Jupyter Notebook ExtensionsHow to get the most from the notebook environmenttowardsdatascience.

com2 — Setting up themesPersonally I’m using this package from dunovank on GitHub:dunovank/jupyter-themesCustom Jupyter Notebook Themes.

Contribute to dunovank/jupyter-themes development by creating an account on GitHub.

github.

comTo install this package simply run the following:pip install jupyterthemesNext initiate your theme of choice dark or light (Please refer to the GitHub link for customisation options) by simply running one of the following commands:# "Default" settings for dark and light themes# DARKjt -t onedork -fs 95 -altp -tfs 11 -nfs 115 -cellw 88% -T# LIGHTjt -t grade3 -fs 95 -altp -tfs 11 -nfs 115 -cellw 88% -TI prefer the dark theme, which makes your notebook look something like this:That’s it!.You’re done.

Enjoy your new environment!Thanks for reading, I hope it was useful for you.

Please leave a comment if you feel like I left something important out or if you simply want to leave some feedback for me!.Also, make sure to follow my profile ????.if you enjoyed it and want to see more!Peter Nistrup – MediumRead writing from Peter Nistrup on Medium.

DATA SCIENCE, STATISTICS & AI .

Stay up to date on Twitter ☞ @PeterNistrup…medium.

com.

. More details

Leave a Reply