Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 6.73 KB

conda_jupyterlab.md

File metadata and controls

62 lines (42 loc) · 6.73 KB

Getting started with Jupyter, conda, Python (relevant scientific packages) and Git/GitHub

We'll point to tutorials and documentation created for OceanHackWeek (OHW) 2020 at the OHW Resources site. When reading these materials, ignore references to JupyterHub or "the Hub". That's a cloud-based deployment of Jupyter. For now, we'll be working only on Jupyter in your own computer ("locally").

To run OHW20 Python tutorials locally, use this conda environment file adapted by paring down the original OHW20 conda environment file, removing all R packages and other packages related to a JupyterHub deployment.

Git/GitHub, Jupyter and relevant Python packages

conda

Go through these instructions. You may also find these materials very helpful:

Installation (installing Python on Windows through conda)

We'll install Python (3.8) via the conda "open source package management system and environment management system". The advantages of conda include:

  • Doesn't require administrative privileges
  • Can be installed side by side with other Python installations w/o interfering with them
  • Allows you to easily create "virtual environments" with custom Python installations

conda can be installed in one of two ways, either with "Anaconda" or "Miniconda". We'll use Miniconda, which is much lighter weight than Anaconda, for your own personal use, you may find Anaconda more user friendly. Go to https://docs.conda.io/en/latest/miniconda.html Download the Windows Python 3.8 installer; I don't know whether you'd use the 32bit or 64 bit one. I did my Windows testing on the 64bit version. If your computer is not too old, I suspect it'll be 64bit; but pick the one that's right for your computer.

Installation instructions for Windows are here. You can find MacOS instructions here, but the process should be pretty similar as on Windows (except that you can do it via the command line, I think).

Assuming you're on Windows 10:

  • After downloading the miniconda .exe file, double-click on it
  • Select the option to install for the local user only
  • Accept the default installation path. I assume it'll be something like C:\Users<USERNAME>\miniconda3
  • On the Advanced Installation Options window, uncheck both boxes ("Add Miniconda3 ..." and "Register Miniconda3 ...")
  • On the "Completing Miniconda3" window, you can do whatever you want (check or uncheck the boxes). If you have no preference, uncheck both boxes.

When installation is finished, from the Start menu, open the Anaconda Prompt or Anaconda Powershell Prompt; the latter will probably be nicer. Test it by running the command "conda list"

Create conda environment and install JupyterLab

You'll need to create a conda "environment" (a Python virtual environment) as needed, customized to the specific need. See this link for complete documentation, though it's not needed here.

Install JupyterLab through a dedicated conda environment; see the User Guide section at https://jupyterlab.readthedocs.io. To install it, open the command shell (see #1 below) then create a new "jupyterlab3" conda environment as follows:

conda create -n jupyterlab3 -c conda-forge jupyterlab=3 nb_conda_kernels

conda environments can be specified and created using a text file called a conda environment file that lists the specific packages and versions that will be used. The environment file is constructed using the yaml format. To create the environment with such a file:

  1. Open the command shell (Anaconda Prompt or Anaconda Powershell Prompt, in my previous instructions).
  2. cd (change directory) to where the conda environment environment.yml file is located. For example: cd C:\Users\user1\fhloo
  3. Create conda environment, assigned the name specified in the file (assume it's MYENV): conda env create -f environment.yml
  4. "Activate" the environment to start using it: conda activate MYENV