Pre-requirements¶
What do you need to be prepared?
- A good Zoom setup: microphone, camera and a place where you can talk
- We use VS Code in our teaching
- VS Code has built-in terminal
- VS Code has built-in
git
version control - VS Code has other useful integrated systems
- You can use another IDE if you are more comfortable with it
- A GitHub account
- A local Python installation
Info
If you have not set up Git/GitHub and have not installed Git, Python and VS code.
Count with ~1 hour of preparations, depending on choices you make (for example, Anaconda takes some time to install).
Checkpoints¶
A good Zoom setup¶
You have a Zoom good setup, if:
- you can talk freely. If not, find a room/place where you can.
- others in the Zoom room can clearly hear what you say. If not, use a microphone.
- you can clearly hear what others in the Zoom room say. If not, use a headset.
Visual Studio¶
You have installed Visual Studio, if:
- You can start Visual Studio
Do you have Visual Studio Code installed?
- Yes!
- No, go to Visual studio
Git¶
We will be using VS Code's built-in git
version control.
You have installed git
, if:
- In a terminal,
git version
shows your version ofgit
Don't have Git installed?
Go to Terminal and Git
- In a terminal,
git config --global user.name
shows your name
Does not show your name?
In a terminal, type:
where [your regular name]
is your regular name, for example:
- In a terminal,
git config --global user.email
shows your email address
Does not show your email?
In a terminal, type:
where [your email]
is your email address, for example:
-
In a terminal,
git config --global pull.rebase
shows something,e.g. the text
false
Does not show your rebase strategy?
In a terminal, to change this to the default, type:
Can you run Git from VS code?
- Yes!
- No go to Using git in VS code
Have you configured a Git (local) account?
- Yes!
- No, go to Configure Git
Have you set up a git ssh-keys?
- Test:
ssh -T git@github.com
- Output should be something like this:
Hi bclaremar! You've successfully authenticated, but GitHub does not provide shell access.
- Output should be something like this:
- Yes!
- If not working, go to to here
You have good enough knowledge of git
, if:
- You know what cloning is
- You know what staging is
- You know what a commit is
- You know what pushing is
- You know what pulling is
- You know how to see the status of your
git
repository - You can do a basic
git
workflow, as described here in 5 minutes.
Do you know basic git?
- I am familiar with basic git commands like
clone
,pull
,push
,add
,commit
,status
,log
- No, go to Git courses
GitHub¶
You have set up a GitHub account, if:
- You can login at https://github.com/
Have you set up a GitHub account?
- Yes!
- No, go to Github
Python¶
You have installed Python, if:
- In a terminal, running
python --version
orpython3 --version
shows the Python version.
Have you installed Python?
- Yes!
- No, go to Python
Can you run Python from VS Code?
- Yes!
- No, go to Python in VS Code
You know enough basic Python, if:
- You can describe what a variable is
- You can change the value of a variable
- You can show the value of a variable on screen
Do you know basic Python?
- Yes!
- Even though it is not part of the course we will use Python in the exercises.
- With other programming languages you can get far, but you may want to learn the basic syntax used in Python!
- To learn more, go to Python courses
Some other solutions¶
Do you want to work in another environment you are used to, you can do some of the steps above and get some inspiration from the other solutions further down.
Visual Studio¶
There are several solutions in how to work with coding and the environments around it
- You can work in the environment(s) you are used to.
- Many of the teachers will use Visual Studio Code (VS code)
- This is not necessary if you have other solution
-
Benefit:
- integrate you terminal and Git work with code development
- graphical user interface
- available in all platforms
-
You may want to check VS Code installation as well!
-
- Note for Mac Users: If Safari does not let you download, try Chrome or other web browser.
Info
Go back to checkpoints
Install Git¶
Git (specific installation may be required) and terminals are already integrated in VS Code and can be the first choice Otherwise follow the steps in the end of this page ([Other solutions]prereqs.md#other-solutions)!
- Version >= 2.28 would do
There are several different ways to run the course material on a Windows computer. Neither is perhaps optimal, and the material itself has not been adapted specifically for Windows. Nevertheless, in principle everything should be possible to run. A few ways you could setup:
Git-windows with a command line and Git integrated
-
Install Git Windows: https://gitforwindows.org/ (easiest if you want to start fast and plan to work in windows environment)
- Follow the setup insctructions from the Windows part at https://coderefinery.github.io/installation/git-in-terminal/ by CodeRefinery.
- Included will be the Git Bash
- We use the VSCode built-in terminal to some extent
- Choose one of your choice, the built-in or another!
- Chances are big that you already have git installed on your computer.
- You can check by running e.g.
git --version
.- and if it reports 2.28 or higher, then you are good.
- If you have a very old version of git or you don't have it, install it following the instructions here
- You may have to do
xcode select --install
from the Mac terminal.
- You may have to do
git
comes installed with all Linux distributions- To install
git
, dosudo apt-get install git
Info
Go back to checkpoints
Using git in VS code¶
- When Git is installed you may need to restart a shell in VS code before it works.
Info
Go back to checkpoints
Configure git¶
This must be done
Follow these instructions. https://nbis-reproducible-research.readthedocs.io/en/course_2104/setup/#installing-git
Info
Go back to checkpoints
GitHub¶
Sign up for GitHub account: https://coderefinery.github.io/installation/github/
Info
Go back to checkpoints
GitβGitHub connection through ssh keys¶
(This may take a while to get working, but is worth it) https://coderefinery.github.io/installation/ssh/
- Test:
ssh -T git@github.com
- Output should be something like this:
Hi bclaremar! You've successfully authenticated, but GitHub does not provide shell access.
- Output should be something like this:
- If not working, these are the approximate steps to be done in your terminal. It can vary between systems, so link above is more certain.
ssh-keygen -t ed25519 -C "<email address for your GitHub account>"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Copy the SSH public key to your clipboard. For WINDOWS:
clip < ~/.ssh/id_ed25519.pub
- On Mac, use
pbcopy
instead, like:
-
Then go to your GitHub account on the web.
- In the upper-right corner of any page, click your profile photo, then click Settings.
- In the "Access" section of the sidebar, click SSH and GPG keys.
- Click New SSH key or Add SSH key.
- In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal laptop, you might call this key "Personal laptop".
- Select the type of key authentication.
- In the "Key" field, paste your public key.
- Click Add SSH key.
- If prompted, confirm access to your account on GitHub.
-
Now test again in your terminal:
ssh -T git@github.com
- Output should be something like this:
Hi bclaremar! You've successfully authenticated, but GitHub does not provide shell access.
- Output should be something like this:
-
If there was a problem, confer the full article Adding a new SSH key to your GitHub account.
Info
Go back to checkpoints
Git courses¶
- Learn the basics!
-
Choose one or several of these!
-
Git courses
Info
Go back to checkpoints
Python¶
- Use what you already have
-
If you don't have Python there are different ways to go. We won't use Conda during the lessons, for instance.
- Bare python (recommended for the "bare metal" user)
- You may need to install other packages (pip)
- install python
- note macOS: the system install of Python on macOS is not supported, instead:
brew install python3
- Anaconda (recommended for python/R developers liking GUI:s)
- Count with 15-20 minutes
- includes
- many many packages
- conda packager
- pip installer
- GUI launchers, like example
- jupyter notebook/lab
- Spyder
- RStudio
- etc...
- install Anaconda
- miniconda (recommended for terminal user)
- Faster to install
- Includes:
- less packages than Anaconda, and no GUI launcher but:
- conda packager
- pip installer
- etc...
- install Miniconda
- Bare python (recommended for the "bare metal" user)
-
In Linux and Bash, Python should work from the command line by typing
python
/python3
or running a script withpython <script>
/python3 <script>
Python in VS Code¶
- Step 1. Install a supported version of Python on your system, see above.
- Step 2. Install the Python extension for Visual Studio Code from the left menu bar.
- Step 3. Open or create a Python file and start coding.
- Example: make a hello.py script and run it with the "play" button.
- Choose which Python interpreter to use.
- Step 4. To run Python from a VS Code terminal (Bash or other) you may have to restart the shell
Info
Go back to checkpoints
Python courses¶
- We assume familiarity with python at least equivalent
-
Learn the basics by choosing one or several of these courses!
- Python part of the UPPMAX introductory course
- Python programming with applications to bioinformatics.
Other solutions¶
There are some other solutions for installations but they are probably not supported by the teachers of the course.
Terminals¶
There are several different ways to run the course material on a Windows computer. Neither is perhaps optimal, and the material itself has not been adapted specifically for Windows. Nevertheless, in principle everything should be possible to run. A few ways you could setup:
Git-windows with a command line and Git integrated
-
Install Git Windows: https://gitforwindows.org/ (easiest if you want to start fast and plan to work in windows environment)
- Follow the setup insctructions from the Windows part at https://coderefinery.github.io/installation/git-in-terminal/ by CodeRefinery.
- Included will be the Git Bash
Other possibilities
- Use the Windows 10 PowerShell
- Use the Linux Bash Shell (WSL) on Windows 10/11 (perhaps best practice if you plan to run Linux as well)
- This will give you access to a full command-line bash shell based on Linux on your Windows 10/11 PC.
- instructions below
- For the difference between the Linux Bash Shell and the PowerShell on Windows 10, see e.g. this article.
- Run as Linux through a virtual machine (and see the Linux setup above)
- not shown
Install Bash on Windows 10/11 (WSL), following the instructions at e.g. 1 of these resources:
Python from In Git-bash (Windows)¶
- Get it working from Git Bash
- if the command
type python
gives you a path, then proceed- otherwise you may have to do a new installation
- or find the path
- if anaconda installation you may add something like this:
echo 'export PATH="<path/to/Anaconda/root>:<path/to/anaconda/root>/Scripts:$PATH:' >> .bashrc
- example:
/c/Users/bjcar425/AppData/Local/anaconda3:/c/Users/bjcar425/AppData/Local/anaconda3/Scripts
- example:
$ alias python='winpty python.exe'
$ python -V
- does it give you the python version 3-something?
- if the command
- Make it permanent
-
$ echo "alias python='winpty python.exe'" >> ~/.bashrc
Parts taken from https://nbis-reproducible-research.readthedocs.io/en/course_2104/setup/