1 - Installing PyCharm Professional for Free

This tutorial teaches how to get PyCharm Professional for free on Windows 10 using a university email address.

Abstract

This tutorial teaches how to get PyCharm Professional for free on Windows 10 using a university email address. You can follow a similar process on Linux and macOS.

Contents

Keywords: pycharm

Steps

Click the following image to be redirected to a YouTube video tutorial for installing PyCharm Professional.

Please ensure that you qualify. This includes you having a valid educational email or be part of an open-source project. Make sure to explore the license agreements for PyCharm as they may change.

  1. Open up a web browser and search pycharm. Look under the link from jetbrains.com and click Download PyCharm.

  2. Click the blue button that reads Download under Professional. Wait for the download to complete.

  3. Open the completely downloaded file and click Yes on the UAC prompt.

    1. If you have a school computer, please refer to the note under step 5 of the Windows section in the Python tutorial found here: https://github.com/cybertraining-dsc/cybertraining-dsc.github.io/blob/main/content/en/docs/tutorial/reu/python/index.md
  4. Click Next, click Next again, and check the box that reads Add launchers dir to the PATH. You can also create a Desktop Shortcut and create the .py association if you would like. The association changes which program, by default, opens .py files on your computer.

  5. Click Next and then click Install. Wait for the green progress bar to complete. Then, you must restart your computer after making sure all of your programs are saved and closed.

  6. Open PyCharm either by clicking on the Desktop shortcut you might have made or hit the Windows key and type PyCharm and choose the program from the search results.

  7. Check the box that says I confirm that I have read and accept the terms... after agreeing to the terms.

  8. Click Continue. You can choose to send anonymous statistics, if you want to; click the option you want.

  9. Click the hyperlink that says Buy license in the top right of the window. Do not worry — you will not be spending a cent.

  10. Click the person icon in the top right of the page (if you cannot find this person icon, then click this link and hopefully, it still works: https://account.jetbrains.com/login ).

  11. Create a JetBrains account by entering your university email address. Click Sign Up after entering your email; then, you have to go on your email and confirm your account in the automated email sent to you. Click Confirm your account in the email.

  12. Complete the registration form and click Submit.

  13. Click Apply for a free student or teacher license. Scroll down and click the blue button that reads Apply now.

  14. Fill out the form using your (educational) email address and real name. Check the boxes if they apply to you. Then click APPLY FOR FREE PRODUCTS.

  15. JetBrains should send you an automated email, ideally informing you that your information has been confirmed and you have been granted a free license. If it does not arrive immediately, wait a few minutes. Go back to PyCharm and sign in with your JetBrains account after receiving this email. Click Activate. Now you can use PyCharm.

2 - Installing Git Bash on Windows 10

Installung Git.

Abstract

This tutorial teaches how to install Git and Git Bash.

Contents

Keywords: git

Windows

Click the following image to be redirected to a YouTube video tutorial for installing Git and Git Bash. This same video also includes instructions to create a virtual Python environment, which you can do as well.

To verify whether you have Git, you can press Win + R on your desktop, type cmd, and press Enter. Then type git clone and press Enter. If you do not have Git installed, it will say 'git' is not recognized as an internal or external command...

As long as Git does not change up their website and hyperlinks, you should be able to download Git from here and skip to step 2: https://git-scm.com/downloads

  1. Open a web browser and search git. Look for the result that is from git-scm.com and click Downloads.

  2. Click Download for Windows. The download will commence. Please open the file once it is finished downloading.

  3. The UAC Prompt will appear. Click Yes because Git is a safe program. It will show you Git’s license: a GNU General Public License. Click Next.

    1. The GNU General Public License means that the program is open-source (free of charge).
  4. Click Next to confirm that C:\Program Files\Git is the directory where you want Git to be installed.

  5. Click Next unless you would like an icon for Git on the desktop (in which case you can check the box and then click Next).

  6. You will be asked several questions for the setup. We recommend the following settings:

    • Click Next to accept the text editor,
    • Click Next again to Let Git decide the default branch name
    • Click Next again to run Git from the command line and 3rd party software,
    • Click Next again to use the OpenSSL library
    • Click Next again to checkout Windows-style,
    • Click Next again to use MinTTY,
    • Click Next again to use the default git pull,
    • Click Next again to use the Git Credential Manager Core,
    • Click Next again to enable file system caching, and then
    • Click Install because we do not need experimental features.
  7. The progress bar should not take too long to finish. To test if it is installed, you can search for Git Bash in the Windows search now to run it.

3 - Using Raw Images in GitHub and Hugo in Compatible Fashion

We need raw images

This tutorial teaches how to add images on GitHub and use them in your markdown file that can be rendered in Hugo and markdownon GitHub.

Contents

Keywords: github

Steps

  1. Upload your image to GitHub in the images directory

  2. Click on the image file and then right click on it and click Open image in new tab

  3. Use the URL shown in the address bar of the new tab to paste into the markdown file.

  4. When using the file, please add a caption; also, if it is copied, make the citation which should point to the reference section

![database sample](https://github.com/cybertraining-dsc/cybertraining-dsc.github.io/raw/main/content/en/docs/tutorial/reu/github/images/images-download.png)

**Figure 2:** Sample Database file obtained from the USGS
water-quality database for the year 2017 [^1]

## Refernces

[^1]: HERE COMES THE CITATION OF THE IMAGE

4 - Using Raw Images in GitHub and Hugo in Compatible Fashion

We need raw images

This tutorial teaches how to add images on GitHub and use them in your markdown file that can be rendered in Hugo and markdownon GitHub.

Contents

Keywords: github

How to use images is clearly shown in our template at

https://github.com/cybertraining-dsc/hid-example/blob/main/project/index.md

5 - Uploading Files to Google Colab

Google Drive File upload for Google Colab

Abstract

This tutorial teaches how to import CSV’s into a Google Colab .ipynb.

Contents

Keywords: colab

Note

There are two different methods of uploading files to Google Colab Jupyter notebooks. One way is to have the user upload the file to the user’s Google Drive before running the notebook. Another way is to have the notebook ask the user to upload a file directly into the notebook from the user’s computer. This tutorial outlines both ways.

The notebook code with both methods can be found here

Read File from Drive

This code will read a CSV file using pandas. Before running it, the user must upload the CSV file to the Google Drive of the same Google account on which it runs the notebook in Colab (e.g., your account). The CSV file in this example is titled kag_risk_factors_cervical_cancer but please rename it accordingly to match the file you would like to upload.

Cell 1:

import pandas as pd
from google.colab import drive 
drive.mount("/content/gdrive", force_remount=True)
# The next line of code will tell Colab to read kag_risk_factors_cervical_cancer.csv in your Drive (not in any subfolders)
# so you should alter the code to match whichever .csv you would like to upload.
df=pd.read_csv('gdrive/My Drive/kag_risk_factors_cervical_cancer.csv')
# The next two lines of code convert question marks to NaN and converts values to numeric type, consider 
# removing the next two lines if not necessary.
df = df.replace('?', np.nan) 
df=df.apply(pd.to_numeric)
# If this cell successfully runs then it should output the first five rows, as requested in the next line of code
df.head(5)

Colab will ask you to click on a blue link and sign in with your account. Once done, the user must copy a code and paste it into the box on Colab for authentication purposes. Press Enter after pasting it into the box.

If it outputs an error along the lines of unknown directory, try rerunning the two cells and ensuring that your CSV is not in any folders inside Google drive. You can also alter the code to point it to a subdirectory if needed.

Read File from Direct Upload

To read it with built-in Colab methods, you can use the following code:

Cell 1:

from google.colab import files
df = files.upload()

The user will be prompted to click Browse... and to find the file on the user’s local computer to upload. Sometimes trying to upload the file will give this error:

MessageError: RangeError: Maximum call stack size exceeded.

In this case, the user should click the folder icon on the left side of Google Colab window, then the paper with an arrow icon (to upload a file), then upload the CSV you wish to use. Then rerunning Cell 1 is not necessary. Simply proceed to Cell 2. If this still does not work, see this stackoverflow page for further information.

Cell 2:

df=pd.read_csv('kag_risk_factors_cervical_cancer.csv')
# The next two lines of code convert question marks to NaN and converts values to numeric type, consider 
# removing the next two lines if not necessary.
df = df.replace('?', np.nan) 
df=df.apply(pd.to_numeric)
# If this cell successfully runs then it should output the first five rows, as requested in the next line of code
df.head(5)

Remember to rename the instances of kag_risk_factors_cervical_cancer.csv accordingly so that it matches your file name.

Acknowledgments

Credit to Carlos who provided the cell to upload the file directly.

6 - Adding SSH Keys for a GitHub Repository

Using SSH keys with GitHub

This tutorial teaches how to configure an SSH Key on GitHub so that you can clone, commit, pull, and push to repositories (repos).

Contents

Keywords: ssh

Windows

Please ensure that you have Git (Git Bash) and a repository on GitHub. This tutorial was created with the REU program in mind, where the students are provided with a GitHub repository. If you are not in REU, then you can create a new repository on GitHub and clone that instead.

  1. Open Git Bash by pressing the Windows key, typing git bash, and pressing Enter.

  2. Then, go on GitHub, click on your profile icon in the top right, click Settings, and click SSH and GPG keys on the left hand side. Confirm that there are no SSH keys associated with your account. If there are keys, then perhaps you have made some already. This tutorial focuses on creating a new one.

  3. Go back to Git Bash and type ssh-keygen. Press Enter. Press Enter again when it asks you the file in which to save the key (it should say Enter file in which to save the key (/c/Users/USERNAME/.ssh/id_rsa):.

    1. If you have already created a key here, it will ask you if you would like to overwrite the file. Type y and press Enter.
  4. Enter a password that you will remember for your SSH key. It will not appear as you type it, so make sure you get it right the first time. Press Enter after typing the password that you come up with.

  5. After seeing the randomart image associated with your SSH, you should be able to type a new command. Type cat ~/.ssh/id_rsa.pub and press Enter. Your key will appear— remember that this should not be shared with others. The key begins with ssh-rsa and it may end with your username. Copy this entire key by clicking and dragging over it, right-clicking, and clicking Copy.

  6. Return to your web browser which is on the GitHub SSH key settings page. Click the green button that reads New SSH Key and type a Title for this key. You should name it something memorable and distinct; for example, if you just generated the key on your desktop computer, a suitable name is Desktop. If generated on your laptop, name it Laptop, or if you have numerous laptops, differentiate them with distinct names, and so on.

    1. If you only have one computer and you have preexisting keys on this page, maybe some which you do not remember the password to or have fallen out of use, consider deleting them (as long as you are sure this will not break anything).
  7. Paste the key into the key box. You should have copied it from Git Bash in Step #5. Then, click the green button that reads Add SSH key. Congratulations— you have successfully configured your SSH key. Now we will try cloning your REU repository.

  8. Navigate to your repository. It should be in the cybertraining-dsc directory with a name format of xxxx-reu-xxx. Once you are on that page, click the green button that reads Code with a download symbol. Click the SSH option and click on the clipboard next to the link so that you copy it. It should say Copied! after you click on it.

  9. Decide where you want your repository folder to be stored. This tutorial will clone the repo into the Documents folder. Go back to Git Bash and type cd ~/Documents and press Enter. It is a good idea to create a folder titled reu for organization. Type mkdir reu and press Enter. Type cd reu and press Enter. Finally, type git clone, and after you put a space after clone, paste the copied link from GitHub. For example, your command should look similar to this: git clone git@github.com:cybertraining-dsc/su21-reu-361.git Then, press Enter.

    1. The shortcut Ctrl + V does not work in Git Bash for pasting. Instead, you can press Shift + Insert to paste.
  10. Type in your password for your SSH key and press Enter. The repo should clone with no issue. You can now type code . and press Enter to open VSCode in this directory. Click Yes, I trust the authors if prompted in VSCode. If you use PyCharm instead of VSCode, you can open it from Windows search; inside of PyCharm, click File, Open... and then navigate to C:, Users, your username, Documents, and then click on reu so it is highlighted in blue and then click OK. If PyCharm asks, you can choose to open it in This Window or a New Window.

7 - Installing Python

Installing Python

Abstract

This tutorial teaches how to install Python on Windows 10. It can be similarly installed also on macOS and Linux.

Contents

Keywords: python

Windows

Click the following image to be redirected to a 2-minute YouTube walkthrough.

  1. First, open the url https://www.python.org/downloads/ in any web browser.

  2. As of June 2021, the latest version of Python is 3.9.6. You may see a different number. We recommend you use the newest official version which is provided to you by simply clicking the button under “Download the latest version for Windows”.

  3. Once the download has completed, open the file by clicking on it in your Downloads pane.

  4. Be sure to check the box that reads “Add Python x.x to PATH”. This will allow you to run commands from the terminal/command prompt.

  5. Click “Install Now”. The default options that entail this selection are appropriate.

    1. The UAC prompt will pop up. UAC stands for “User Account Control” and exists so that the computer will not have unauthorized changes performed on it. Click “Yes” because Python is safe. School-issued computers may ask for an administrator password, so contact your IT department or professor.
  6. The installation will take some time.

  7. If the setup was successful, then it will say so. Click “Close”.

  8. Click the “Type here to search” box in the bottom-left of the screen, type “cmd”, and press Enter.

    1. An alternative method is to press the Windows key and the “R” key at the same time, type “cmd”, and press Enter. This is convenient for those who like to use the keyboard.
  9. Type python --version and the output should read “Python x.x.x”; as long as it is the latest version from the website, congratulations. Python is installed on the computer.

Mac

Click the following image to be redirected to a 5-minute YouTube walkthrough. (Yes, Mac’s video is a little longer, but do not fret! You can skip to the 1:00 minute mark if you are in a hurry.)

  1. First, open the url https://www.python.org/downloads/ in any web browser.

  2. Underneath Download the latest version for Mac OS X, there should be a yellow button that reads Download Python x.x.x. Click on it, and the download should commence.

  3. Once the download finishes, open it by clicking on it. The installer will open. Click Continue, click Continue again, and click Continue again. Read the agreements.

  4. Click Agree.

    1. If you want to check how much free storage you have on your computer, click the Apple icon in the top left of your computer. Click About This Mac and then click on Storage. As of July 2021, Python takes ~120 MB of space. Remember that 1 GB = 1000 MB.
  5. Click Install. Enter your password and press Enter. The installation will take a while.

  6. A Finder window will open. You can close it as it is unnecessary. Click Close in the bottom-right of the installer. Click Move to Trash because you do not need the installer anymore.

  7. Next confirm that Python installed correctly. Click the magnifying glass in the top-right of your screen and then type terminal into Spotlight Search. Double-click Terminal.

    1. The terminal will be used frequently. Consider keeping it in the dock for convenience. Click and hold the Terminal in the dock, go to Options, and click Keep in Dock.
  8. Type python3 --version into the terminal and press Enter. It should output the latest version of Python. Congratulations!

Linux

Click the following image to be redirected to a 9-minute YouTube walkthrough. (Linux’s tutorial is the longest, but it is worth it.) This tutorial uses Ubuntu, but it should work on other Linux distros, as well.

  • Naturally we recommend that you read all of the licensing information.
  1. First, open the url https://www.python.org/downloads/ in any web browser.

  2. Look at the latest version. It is on the yellow button: Download Python x.x.x. You do not need to click this button. Remember this version number.

  3. Open a terminal by pressing the Windows key or by clicking the grid on the bottom left of your screen. Type terminal. Click on the Terminal result that appears.

  4. Next, prepare your system:

Note: If you want to check how much disk space you have, you can use

$ df -h /
Filesystem       Size   Used  Avail Capacity iused       ifree %iused  Mounted on
/dev/disk1s5s1  1.8Ti   14Gi  387Gi     4%  553757 19538475003    0%   /

The value under Avail will be your available space. Make sure you have sufficient space.

$ sudo apt-get update
$ sudo apt install -y wget curl
$ sudo apt install -y openssl libssl-dev
$ sudo apt install -y build-essential zlib1g-dev libncurses5-dev 
$ sudo apt install -y libgdbm-dev libnss3-dev  libreadline-dev libffi-dev libsqlite3-dev libbz2-dev
  1. After this finishes, type cd /opt and press Enter. Then, remember which version you read on the Python webpage (the latest version) and add it as environment variable PV to your terminal so we can more easily execute commands that include the version number. Type:

    $ PV=3.9.6
    $ sudo wget https://www.python.org/ftp/python/$PV/Python-$PV.tgz
    $ sudo tar xzvf Python-$PV.tgz
    $ cd Python-$PV
    $ ./configure --enable-optimizations
    $ make
    $ sudo make altinstall
    
  2. Confirm Python’s successful installation by typing pythonx.x --version; be sure to replace x.x with the first two numbers of the version number. It should output the latest version number. Congratulations!

Python venv

Before you install packages, you need to create a Python venv in your local environment. We typically do this with

$ python3.9 -m venv ~/ENV3
$ source ~/ENV3/bin/activate

or for Windows executed in git bash

$ python -m venv ~/ENV3
$ source ~/ENV3/Scripts/activate

Troubleshooting

Incorrect Python Version on Command Prompt (Windows)

If the Windows computer has previously installed an older version of Python, running python --version on Command Prompt may output the previously installed older version. Typing python3 --version may output the correct, latest version.

8 - Installing Visual Studio Code

Installing Visual Studio Code

Abstract

This tutorial teaches how to install Visual Studio Code on Windows 10.

Contents

Keywords: visual-studio-code

Steps

Click the following image to be redirected to a YouTube video tutorial for installing Visual Studio Code (also called VSCode).

Sidenote: An exasperated reader may wonder, “why go through steps 1-3 when it can be as easy as clicking a link to the VSCode download page?” This would be easier, but hyperlinks (or URLs) are bound to change through the years of website maintenance and alterations. (One could also argue that steps 1-3 could become incorrect, as well, but hopefully they will not.) If you, time-traveler, would like to try your luck, go here: https://code.visualstudio.com/download

If the link works, skip to step 4.

P.S. It should be second-nature to a user to quickly search, find, download, and install a program. It is vital to ensure that the correct program is downloaded and installed, however. Over time, guides like this one can become deprecated, but one must be resilient in problem-solving. Use search engines like Google to find what you are looking for. If one path does not work, take another that will lead to the same destination or a better one.

  1. Open up your favorite web browser. This can be done by pressing the Windows key and typing in the name of the browser, like google chrome (as long as this browser is already installed on your computer). Then press Enter.

  2. Once the browser loads, search for visual studio code through the address bar. Press Enter and you will see a list of results through the default search engine (Google, Bing, or whatever is configured on your browser).

  3. Identify the result that reads code.visualstudio.com. If using Google, a subresult should read Download. Click that link.

  4. This tutorial assumes that the reader is using Windows. Click the blue link that reads Windows. The download will commence; wait for it to finish.

  5. Click and open the file once it finishes; the license agreement will appear. If you are proficient in legalese, you can read the wall of text. Then, click I accept the agreement and click Next.

  6. Click Next again; it is best to leave the default install path alone for reproducibility in this experiment.

  7. Click Next again to create a Start Menu folder. Ensure that Add to PATH is checked. Create a desktop icon can be checked for convenience; it is up to the reader’s choice. Then click Next.

  8. Click Install and watch the green progress bar go at the speed of light. Once completed, click Finish. VSCode will open as long as everything went smoothly.