Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.
This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl
Note: $
denotes the start of a command. Don't actually type this.
- Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
- Go to https://repo.continuum.io/archive to find the list of Anaconda releases
- Select the release you want. I have a 64-bit computer, so I chose the latest release ending in
x86_64.sh
. If I had a 32-bit computer, I'd select thex86.sh
version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I choseAnaconda3-5.2.0-Linux-x86_64.sh
. - From the terminal run
wget https://repo.continuum.io/archive/[YOUR VERSION]
. Example:$ wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh
- Run the installation script:
$ bash Anaconda[YOUR VERSION].sh
($ bash Anaconda3-5.2.0-Linux-x86_64.sh
) - Read the license agreement and follow the prompts to accept. When asks you if you'd like the installer to prepend it to the path, say yes.
- Optionally install VS Code when prompted (some have reported this installation doesn't work - checkout https://gist.github.com/kauffmanes/5e74916617f9993bc3479f401dfec7da#gistcomment-3665550)
- Close the terminal and reopen it to reload .bash configs.
- To test that it worked, run
$ which python
. It should print a path that has anaconda in it. Mine is/home/kauff/anaconda3/bin/python
. If it doesn't have anaconda in the path, do the next step. Otherwise, move to step 11. - Manually add the Anaconda bin folder to your PATH. To do this, I added "export PATH=/home/kauff/anaconda3/bin:$PATH" to the bottom of my ~/.bashrc file.
- To open jupyter, type
$ jupyter notebook --no-browser
. The no browser flag will still run Jupyter on port 8888, but it won't pop it open automatically. it's necessary since you don't have a browser (probably) in your subsystem. In the terminal, it will give you a link to paste into your browser. If it worked, you should see your notebooks!
Leave a comment on anything you see that doesn't work and I can look into it!
- made a symlink between my C:/Users/kauff/Documents/JupyterNotebooks folder (where I put my downloaded notebooks in Windows) to my Ubuntu notebook directory: In the WSL terminal:
cd ~
ln -s /mnt/c/Users/kauff/Documents/JupyterNotebooks/ notebooks
Now when you look at Jupyter on :8888, you should see a notebooks folder that has everything your C:/Users/kauff folder has.- I made an alias for the juypter command by putting this command in my .bash_aliases:
alias jup='cd /home/kauff/notebooks && jupyter notebook --no-browser
. Restart the terminal for this new command to take effect. - To test, simply type
jup
from anywhere in the ubuntu directory and it will take you notebooks folder and run jupyter. When you copy and paste the URL, you'll see everything in your C:/Users/kauff/JupyterNotebooks folder.
Thanks to Alexander for the tip:
"A note to be made from my installation -- there was an issue with Jupyter that required conda update conda
and conda update conda-build
. I then uninstalled/reinstalled jupyter with conda to avoid a 500 error for dependencies".
https://conda.io/docs/glossary.html#anaconda-glossary https://www.cgranade.com/blog/2016/08/22/qutip-on-wsl.html https://jupyter.readthedocs.io/en/latest/install.html
Great tutorial!
However, I couldn't install VS code via the anaconda installer. The anaconda installer attempted to install the Linux version of VS code, whereas I needed the Windows version of VS code with the Remote WSL extension.
Here are the instructions that got VS code working for me in WSL: https://code.visualstudio.com/docs/remote/wsl-tutorial
You may want to caution users not to install VS code via anaconda and instead follow these instructions.