Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Log on to your SAIL desktop.
  2. Click on the Start menu (the little Windows icon on the bottom left) → Anaconda3 (64-bit) → Anaconda Prompt (Anaconda3). This will open a command line window with a line of text like:
    1. (base) C:\Users\<your username will be here>
  3. Now we need to make an environment to use. In this command line window, type the following and then hit 'Enter':
    1. conda create -p P:\<your username here>\<name of your new environment> –-channel=anaconda --channel=conda-forge nb_conda_kernels pandas numpy jupyterlab
    2. For example, if my username is 'leal' and I want to create an environment called 'mynewenv' in a folder called 'conda-envs', the command I would run would be:
      1. conda create -p P:\leal\conda-envs\mynewenv –-channel=anaconda --channel=conda-forge nb_conda_kernels pandas numpy jupyterlab
  4. Wait a little while until the window asks you whether to proceed - hit 'y' on your keyboard and then press 'Enter'.
  5. Wait while your new environment is created and all requested packages are installed.
  6. You might get a pop-up saying, "this app has been blocked by your system administrator" this is fine, and it all worked. Just click 'Close' on the message.
  7. After your environment is created, you need to activate it by typing the following in the same command line window:
    1. conda activate P:\<your username here>\<name of your new environment>
    2. So, if my username is 'leal' and I created an environment called 'mynewenv' in a folder called 'conda-envs', I would use the command:
      1. conda activate P:\leal\conda-envs\mynewenv
  8. You'll know when the environment is activated because , as in the image above, the environment name and path will be in brackets as in the image above.
  9. Congratulations, you can now move on to the next part of the guide.

Starting Jupyter

This assumes that you have done the initial setup and have an environment saved on your P: (pronounced 'P drive').

Special steps for R users

If you want to use R in a Jupyter environment, then you will need to follow the below steps rather than the above steps for Python. By following these instructions, your R packages will be successfully installed into your created Anaconda environment rather than in a shared location that RStudio uses, which can cause problems down the lineSuppose you've just completed the initial setup and have your new environment activated in an open command line window. In that case, you can skip steps 1-3.

  1. Log on to your SAIL desktop.
  2. Click on the Start menu (the little Windows icon on the bottom left) → Anaconda3 (64-bit) → Anaconda Prompt (Anaconda3). This will open a command line window with a line of text like:
    1. (base) C:\Users\<your username will be here>
    Activate your
    1. Image Added
  3. Now we need to make an environment to use. In this command line window, type the following and then hit 'Enter':
    1. conda create -p
    conda environment by typing the following in the same command line window:
    1. conda activate P:\<your username here>\<name of your new environment>
    2. So, if my username is 'leal' and I created an environment called 'mynewenv' in a folder called 'conda-envs', I would use the command:
      1. conda activate P:\leal\conda-envs\mynewenv
    3. You will know when the environment is activated because the window will show a line of text like:
      1. (P:\<your username>\<your environment name>) C:\Users\<your username>
    4. –-channel=anaconda --channel=conda-forge --channel=r r-base=4.1.3 r-irkernel nb_conda_kernels jupyterlab r-essentials
    5. For example, if my username is 'leal' and I want to create an environment called 'renv' in a folder called 'conda-envs', the command I would run would be:
      1. conda create -p P:\leal\conda-envs\renv –-channel=anaconda --channel=conda-forge --channel=r r-base=4.1.3 r-irkernel nb_conda_kernels jupyterlab r-essentials
  4. Wait a little while until the window asks you whether to proceed - hit 'y' on your keyboard and then press 'Enter'.
    1. Image Added
  5. Wait while your new environment is created and all requested packages are installed.
    1. Image Added
    2. Image Added
  6. After your environment is created, you need to activate it by typing the following in the same command line window:
    1. conda activate P:\<your username here>\<name of your new environment>
    2. So, if my username is 'leal' and I created an environment called 'renv' in a folder called 'conda-envs', I would use the command:
      1. conda activate P:\leal\conda-envs\renv
      2. Image Added
  7. You'll know when the environment is activated because the environment name and path will be in brackets as in the image above.
  8. Next, you need to install a package that will force R to look in your Anaconda environment for installed packages. To do this, in the same command line window we've been using, type the following and hit 'Enter':
    1. conda install -c conda-forge conda-ecosystem-user-package-isolation

    2. Type 'y' to agree to the installation and wait while it completes.
  9. Your Anaconda window will probably go a bit weird after installing that last one, so just quit it (click the "X" in the top right) and then launch a new Anaconda Prompt window (as in step 2).
  10. Activate your env where we've installed these new things using:
    1. conda activate P:\<your username here>\<name of your new environment>
    2. So, if my username is 'leal' and I created an environment called 'renv' in a folder called 'conda-envs', I would use the command:
      1. conda activate P:\leal\conda-envs\renv
    3. Image Added
    4. You'll know when the environment is activated because the environment name and path will be in brackets as in the image above.
  11. Congratulations! You can now move on to the "Starting Jupyter" section.

Starting Jupyter

This assumes you have done the initial setup and saved an environment on your P: (pronounced 'P drive').

Suppose you've just completed the initial setup and have your new environment activated in an open command line window. In that case, you can skip steps 1-3.

  1. Log on to your SAIL desktop.
  2. Click on the Start menu (the little Windows icon on the bottom left) → Anaconda3 (64-bit) → Anaconda Prompt (Anaconda3). This will open a command line window with a line of text like:
    1. (base) C:\Users\<your username will be here>
  3. Activate your conda environment by typing the following in the same command line window:
    1. conda activate P:\<your username here>\<name of your new environment>
    2. So, if my username is 'leal' and I created an environment called 'mynewenv' in a folder called 'conda-envs', I would use the command:
      1. conda activate P:\leal\conda-envs\mynewenv
    3. You will know when the environment is activated because the window will show a line of text like:
      1. (P:\<your username>\<your environment name>) C:\Users\<your username>
  4. VERY IMPORTANT: Before starting Jupyter, we must ensure we're on the P: in the command line window. To do this, type the following into the window and press Enter:
    1. P:
  5. Then type the following and press Enter:
    1. cd <your username here>
    2. So if my username is 'leal', I would type:
      1. cd leal
  6. (Optional) You might want to navigate to the specific folder in which you'll be working/saving this work, but that is out of the scope of this simple guide.
  7. We are now ready to start Jupyter. In the command line window, type and hit Enter with either of the following commands:
    1. jupyter notebook
      1. This will give you the 'classic' Jupyter interface.
    2. jupyter lab
      1. This gives you a more modern Jupyter interface.
  8. Jupyter will automatically open in a Microsoft Edge tab. You can navigate wherever you want to save your notebooks, create folders, make your notebooks, etc.
    1. You need to must leave the Anaconda Prompt window open while you're using Jupyter.
  9. To ensure that you're using the correct environment kernel in Jupyter, you need to pay attention when creating notebooks.
    1. In the 'classic' interface:
      1. Click on 'New' in the top right.
      2. In the drop-down window that opens, make sure you choose the option called 
        1. Python \[conda env: <name of your conda env here>\]*
    2. In the modern interface:
      1. Under the 'Notebook' heading in the launcher tab, select the one with the name
        1. Python \[conda env: <name of your conda env here>\]*
        2. Image Removed
  10. When you're done and want to exit Jupyter, click on the 'Anaconda Prompt' window on the taskbar, click somewhere in the window, and press Ctrl+C twice.
  11. Please wait a few seconds; Jupyter should shut down, making it safe to close your notebook.

Installing packages

This assumes that you've completed the initial setup and have an environment saved on your P: .

Suppose you've just completed the initial setup and have your new environment activated in an open command line window. In that case, you can skip steps 1-3.

We strongly recommend users try installing from Anaconda sources for package installation. You should only use pip if a package isn't available from Anaconda channels.

    1. In the modern interface:
      1. Under the 'Notebook' heading in the launcher tab, select the one with the name
        1. Python \[conda env: <name of your conda env here>\]*
        2. Image Added
  1. When you're done and want to exit Jupyter, click on the 'Anaconda Prompt' window on the taskbar, click somewhere in the window, and press Ctrl+C twice.
  2. Please wait a few seconds; Jupyter should shut down, making it safe to close your notebook.

Installing packages

This assumes you've completed the initial setup and have an environment saved on your P: .

Suppose you've just completed the initial setup and have your new environment activated in an open command line window. In that case, you can skip steps 1-3.

We strongly recommend users try installing from Anaconda sources for package installation. You should only use pip if a package isn't available from Anaconda channels.

  1. Log on to your SAIL desktop.
  2. Click on the Start menu (the little Windows icon on the bottom left) → Anaconda3 (64-bit) → Anaconda Prompt (Anaconda3). This will open a command line window with a line of text like:
    1. (base) C:\Users\<your username will be here>
  3. Activate your conda environment by typing the following in the same command line window:
    1. conda activate P:\<your username here>\<name of your new environment>
    2. So, if my username is 'leal' and I created an environment called 'mynewenv' in a folder called 'conda-envs', I would use the command:
      1. conda activate P:\leal\conda-envs\mynewenv
    3. You will know when the environment is activated because the window will show
  4. Log on to your SAIL desktop.
  5. Click on the Start menu (the little Windows icon on the bottom left) → Anaconda3 (64-bit) → Anaconda Prompt (Anaconda3). This will open a command line window with
    1. a line of text like:
      1. (
      base) C:\Users\<your username will be here>
  6. Activate your conda environment by typing the following in the same command line window:
    1. conda activate P:\<your username here>\<name of your new environment>
    2. So, if my username is 'leal' and I created an environment called 'mynewenv' in a folder called 'conda-envs', I would use the command:
      1. conda activate P:\leal\conda-envs\mynewenv
    3. You will know when the environment is activated because the window will show a line of text like:
      1. (P:\<your username>\<your environment name>) C:\Users\<your username>
  7. Outside your SAIL desktop, go to Google and search '<name of the package you want to install> anaconda'.
    1. For example, if I want to install the package 'recordlinkage', I would search on Google for 'recordlinkage anaconda'.
  8. Select the Google result from anaconda.org; this should take you directly to the Anaconda page for the package.
  9. On the page, there will be a command that tells you how to install it. Sticking with the recordlinkage example, the webpage shows me that the command to install is:
    1. conda install -c conda-forge recordlinkage
  10. Go back to your SAIL desktop and type this installation command into your Anaconda Prompt window, hitting 'Enter'.
  11. Wait for Anaconda to ask you if you want to proceed - hit 'y' on your keyboard and then press 'Enter'.
      1. P:\<your username>\<your environment name>) C:\Users\<your username>
  12. Outside your SAIL desktop, go to Google and search '<name of the package you want to install> anaconda'.
    1. For example, if I want to install the package 'recordlinkage', I would search on Google for 'recordlinkage anaconda'.
  13. Select the Google result from anaconda.org; this should take you directly to the Anaconda page for the package.
  14. On the page, a command will tell you how to install it. Sticking with the recordlinkage example, the webpage shows me that the command to install is:
    1. conda install -c conda-forge recordlinkage
  15. Return to your SAIL desktop and type this installation command into your Anaconda Prompt window, hitting 'Enter'.
  16. Wait for Anaconda to ask you if you want to proceed - hit 'y' on your keyboard and then press 'Enter'.
  17. Your package is installed! 

Installing packages in R using install.packages()

This assumes you've completed the initial setup and have an environment saved on your P: .

We strongly recommend users try installing from Anaconda sources for package installation. You should only use CRAN if a package isn't available from Anaconda channels.

  1. Complete steps 1-9 in the "Starting Jupyter" section above.
  2. In the Jupyter Notebook that launched when you clicked on the card with the title: 
    1. R \[conda env: <name of your conda env here>\]*
  3. Type the following in a cell and execute it:
    1. install.packages("<name of package to install>", repos="http://cran.rstudio.com")
    2. For example, to install the "rmarkdown" package, you would do
      1. install.packages("rmarkdown", repos="http://cran.rstudio.com")
  4. Your package is installed!Your package is installed! 


...

Instructions with explanations

...